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

Merge pull request #59 from OmgImAlexis/master

add support for custom mutation name
This commit is contained in:
Viktor
2018-09-12 16:37:13 +03:00
committed by GitHub
2 changed files with 67 additions and 2 deletions
+6 -1
View File
@@ -21,6 +21,7 @@ export default class {
this.connect(connectionUrl, opts)
if (opts.store) { this.store = opts.store }
if (opts.mutations) { this.mutations = opts.mutations }
this.onEvent()
}
@@ -91,6 +92,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)
}
}
}