Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const deleteUser = (id, callback) => (dispatch, getState) => dispatch(
mutateAsync({
url: `${ENDPOINT}${id}`,
options: { method: 'DELETE' }
})
)
.then(function() {
// NOTE: When server responds with 204 (no content), redux-query will not
// call either of the callback functions, transform and update
dispatch(remove(DOMAIN, id))
dispatch(setTotal(DOMAIN, getTotal(getState(), DOMAIN) - 1))
dispatch(clearFromPageOnwards(DOMAIN, getPageNumber(getState(), DOMAIN)))
callback()
})
(...args) => {
const queryConfig = makeQueryConfig(...args);
setQueryConfig(queryConfig);
return reduxDispatch(mutateAsync(queryConfig));
},
[makeQueryConfig, reduxDispatch],