(token, password, navigate)
| 322 | } |
| 323 | |
| 324 | export 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 | } |
no test coverage detected