Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
onStart(actionCall, ctx) {
if (!serverAction) {
// if the action does not come from the server cancel it silently
// and send it to the server
// it will then be replicated by the server and properly executed
server.sendMessage(serializeActionCall(actionCall, rootStore))
ctx.data[cancelledActionSymbol] = true // just for logging purposes
// "cancel" the action by returning undefined
return {
result: ActionTrackingResult.Return,
value: undefined,
}
} else {
// just run the server action unmodified
return undefined
}
},
})