How to use the redux-query.mutateAsync function in redux-query

To help you get started, we’ve selected a few redux-query examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github redradix / redux-base-app / src / services / users / actions.js View on Github external
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()
})
github amplitude / redux-query / packages / redux-query-react / src / hooks / use-mutation.js View on Github external
(...args) => {
      const queryConfig = makeQueryConfig(...args);

      setQueryConfig(queryConfig);

      return reduxDispatch(mutateAsync(queryConfig));
    },
    [makeQueryConfig, reduxDispatch],