Is it possible to transform event name like eventToActionTransformer but for component ?
amiceli opened this issue · 2 comments
amiceli commented
Currently in my project, on client side I receive only one event but with more details inside.
For example :
{ name : 'delete_users', origin : '', date : ''}
or
{ name : 'users_synchronized', origin : '', date : ''}
So, on my vue component I've following code :
export default {
//
sockets : {
event (payload) { // "event" is really socket io event name ...
if (payload.data.name === 'deleted_users') {
// stuff
}
if (payload.data.name === 'users_synchronized') {
// stuff
}
},
}
//
}
Is there a way to map or transform event name like eventToActionTransformer but for components ?
To update component like this :
export default {
//
sockets : {
deleted_users (payload) {
// stuff
},
users_synchronized (payload) {
// stuff
},
}
//
}