Adds support for mutations with '.', '-', ' '.

Mutations now support events similar to actions and
matches example in README.
e.g. emit('user-message', ...);
     -> SOCKET_USER_MESSAGE
This commit is contained in:
Zack Neyland 2017-07-20 23:47:46 -07:00
parent d3c8d11f9e
commit cba4d743b3

View file

@ -44,7 +44,7 @@ export default class{
for(let namespaced in this.store._mutations) {
let mutation = namespaced.split('/').pop()
if(mutation === event.toUpperCase()) this.store.commit(namespaced, payload)
if(mutation === event.replace(/\W/g, '_').toUpperCase()) this.store.commit(namespaced, payload)
}
for(let namespaced in this.store._actions) {