MCPcopy Create free account
hub / github.com/flatlogic/react-material-admin / resetPassword

Function resetPassword

src/context/UserContext.js:324–349  ·  view source on GitHub ↗
(token, password, navigate)

Source from the content-addressed store, hash-verified

322}
323
324export function resetPassword(token, password, navigate) {
325 return (dispatch) => {
326 if (!config.isBackend) {
327 navigate('/login');
328 } else {
329 dispatch({
330 type: 'RESET_REQUEST',
331 });
332 axios
333 .put('/auth/password-reset', { token, password })
334 .then(() => {
335 dispatch({
336 type: 'RESET_SUCCESS',
337 });
338 showSnackbar({
339 type: 'success',
340 message: 'Password has been updated',
341 });
342 navigate('/login');
343 })
344 .catch((err) => {
345 dispatch(authError(err.response.data));
346 });
347 }
348 };
349}

Callers 1

doResetFunction · 0.90

Calls 2

showSnackbarFunction · 0.90
authErrorFunction · 0.85

Tested by

no test coverage detected