mirror of
https://github.com/tenrok/vue-native-websocket.git
synced 2026-06-01 22:14:05 +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
|
||||
if (this.format === 'json' && event.data) {
|
||||
msg = JSON.parse(event.data)
|
||||
target = [msg.namespace || '', msg.mutation].filter((e) => !!e).join('/')
|
||||
if (msg.action) {
|
||||
if (msg.mutation) {
|
||||
target = [msg.namespace || '', msg.mutation].filter((e) => !!e).join('/')
|
||||
} else if (msg.action) {
|
||||
method = 'dispatch'
|
||||
target = msg.action
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user