2
0
mirror of https://github.com/tenrok/vue-native-websocket.git synced 2026-06-21 12:00:34 +03:00

add support for custom mutation name

This commit is contained in:
Alexis Tyler
2018-06-12 15:46:29 +09:30
parent 60a80f877f
commit a5e3c863a5
2 changed files with 67 additions and 2 deletions
+6 -1
View File
@@ -15,6 +15,7 @@ export default class {
this.connect(connectionUrl, opts)
if (opts.store) { this.store = opts.store }
if (opts.mutations) { this.mutations = opts.mutations }
this.onEvent()
}
@@ -74,6 +75,10 @@ export default class {
target = [msg.namespace || '', msg.action].filter((e) => !!e).join('/')
}
}
this.store[method](target, msg)
if (this.mutations) {
this.store[this.mutations[method] || method](target, msg)
} else {
this.store[method](target, msg)
}
}
}