fix(observer): lowercased event name before translation

Fixes #99
This commit is contained in:
Sergey Stotskiy 2017-11-20 14:06:35 +02:00
parent 57887ea0a1
commit 34561d8d03

View file

@ -52,9 +52,9 @@ export default class{
if(!action.startsWith('socket_')) continue if(!action.startsWith('socket_')) continue
let camelcased = 'socket_'+event let camelcased = 'socket_'+event.toLowerCase()
.replace('SOCKET_', '') .replace('SOCKET_', '')
.replace(/^([A-Z])|[\W\s_]+(\w)/g, (match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()) .replace(/[\W\s_]+(\w)/g, (match, p1) => p1.toUpperCase())
if(action === camelcased) this.store.dispatch(namespaced, payload) if(action === camelcased) this.store.dispatch(namespaced, payload)
} }