Skip to content

Instantly share code, notes, and snippets.

@jacobp100
Last active July 16, 2016 21:00
Show Gist options
  • Save jacobp100/8c603ccd279edcb961d85fec4fee754f to your computer and use it in GitHub Desktop.
Save jacobp100/8c603ccd279edcb961d85fec4fee754f to your computer and use it in GitHub Desktop.
export const updateRemoveCatViaForm = inputParams => async dispatch => {
const { action, id } = inputParams;
const params = await schema.validate(inputParams, {
abortEarly: false,
stripUnknown: true,
});
return await action === 'remove'
? dispatch(removeCat(id))
: dispatch(updateCat(id, params));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment