mirror of
https://github.com/tenrok/vue-native-websocket.git
synced 2026-06-21 14:20:35 +03:00
Fix observer mutation name when format: json is used (#9)
According to the documentation: "If there is a .mutation value in the response data, the corresponding mutation is called with the name SOCKET_[mutation value]" However when event data does not contains .mutation value mutation is null, so the mutation is not find in the store.
This commit is contained in:
+3
-2
@@ -34,8 +34,9 @@ export default class {
|
|||||||
let msg = event
|
let msg = event
|
||||||
if (this.format === 'json' && event.data) {
|
if (this.format === 'json' && event.data) {
|
||||||
msg = JSON.parse(event.data)
|
msg = JSON.parse(event.data)
|
||||||
target = [msg.namespace || '', msg.mutation].filter((e) => !!e).join('/')
|
if (msg.mutation) {
|
||||||
if (msg.action) {
|
target = [msg.namespace || '', msg.mutation].filter((e) => !!e).join('/')
|
||||||
|
} else if (msg.action) {
|
||||||
method = 'dispatch'
|
method = 'dispatch'
|
||||||
target = msg.action
|
target = msg.action
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user