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:
+6
-1
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user