Created
October 27, 2020 15:47
-
-
Save binjospookie/87baaa131081998a6e4735aaa141c291 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const addExternalProcessingData = declareAction<Record<string, unknown>>(); | |
const EVENTS = { | |
[EVENT_NAME.ADD_PROCESSING_DATA]: addExternalProcessingData, | |
} as const; | |
const makeCall = (store: Store) => ({ | |
name, | |
payload, | |
}: { | |
readonly name: string; | |
readonly payload: unknown; | |
}): boolean => { | |
const action = EVENTS[name]; | |
if (!action || !isActionCreator(action)) { | |
return false; | |
} | |
store.dispatch(action(payload)); | |
return true; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment