mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 09:28:54 +00:00
* API client sends reset password requests * ResetPasswordPage actions and reducer * Reset password happy path
41 lines
771 B
JavaScript
41 lines
771 B
JavaScript
import {
|
|
CLEAR_RESET_PASSWORD_ERRORS,
|
|
RESET_PASSWORD_ERROR,
|
|
RESET_PASSWORD_REQUEST,
|
|
RESET_PASSWORD_SUCCESS,
|
|
} from './actions';
|
|
|
|
export const initialState = {
|
|
error: null,
|
|
loading: false,
|
|
};
|
|
|
|
export default (state = initialState, { type, payload }) => {
|
|
switch (type) {
|
|
case CLEAR_RESET_PASSWORD_ERRORS:
|
|
return {
|
|
...state,
|
|
error: null,
|
|
};
|
|
case RESET_PASSWORD_ERROR:
|
|
return {
|
|
...state,
|
|
error: payload.error,
|
|
loading: false,
|
|
};
|
|
case RESET_PASSWORD_REQUEST:
|
|
return {
|
|
...state,
|
|
loading: true,
|
|
};
|
|
case RESET_PASSWORD_SUCCESS:
|
|
return {
|
|
...state,
|
|
error: null,
|
|
loading: false,
|
|
};
|
|
default:
|
|
return state;
|
|
}
|
|
};
|
|
|