Skip to content

Instantly share code, notes, and snippets.

@jacobp100
Last active July 14, 2016 19:42
Show Gist options
  • Save jacobp100/8f3455ca6b7b39d29d5a631cdcdbe0be to your computer and use it in GitHub Desktop.
Save jacobp100/8f3455ca6b7b39d29d5a631cdcdbe0be to your computer and use it in GitHub Desktop.
export const addCat = params => async dispatch => {
const cat = await fetchJson('PUT', '/cats', params);
dispatch({ type: UPDATE_CAT, cat });
};
export const addCatViaForm = inputParams => async dispatch => {
const params = await schema.validate(inputParams, {
abortEarly: false,
stripUnknown: true,
});
dispatch(addCat(params));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment