File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -117,14 +117,18 @@ export default function prepareMakeServicePlugin(
117
117
// (3^) Setup real-time events
118
118
if ( options . enableEvents ) {
119
119
const handleEvent = ( eventName , item , mutationName ) => {
120
- const affectsStore = options . handleEvents [ eventName ] ( item , {
120
+ const handler = options . handleEvents [ eventName ]
121
+ const confirmOrArray = handler ( item , {
121
122
model : Model ,
122
123
models : globalModels
123
124
} )
125
+ const [ affectsStore , modified = item ] = Array . isArray ( confirmOrArray )
126
+ ? confirmOrArray
127
+ : [ confirmOrArray ]
124
128
if ( affectsStore ) {
125
129
eventName === 'removed'
126
- ? store . commit ( `${ options . namespace } /removeItem` , item )
127
- : store . dispatch ( `${ options . namespace } /${ mutationName } ` , item )
130
+ ? store . commit ( `${ options . namespace } /removeItem` , modified )
131
+ : store . dispatch ( `${ options . namespace } /${ mutationName } ` , modified )
128
132
}
129
133
}
130
134
You can’t perform that action at this time.
0 commit comments