mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 09:28:54 +00:00
- Remove require password reset from ModifyUser and RequestPasswordReset methods, and UserPayload struct - Add new RequirePasswordReset method - Refactor JS for new separate method
35 lines
823 B
JavaScript
35 lines
823 B
JavaScript
import {
|
|
REQUIRE_PASSWORD_RESET_FAILURE,
|
|
REQUIRE_PASSWORD_RESET_REQUEST,
|
|
REQUIRE_PASSWORD_RESET_SUCCESS,
|
|
} from './actions';
|
|
import config, { initialState } from './config';
|
|
|
|
export default (state = initialState, { type, payload }) => {
|
|
switch (type) {
|
|
case REQUIRE_PASSWORD_RESET_REQUEST:
|
|
return {
|
|
...state,
|
|
errors: {},
|
|
loading: true,
|
|
};
|
|
case REQUIRE_PASSWORD_RESET_SUCCESS:
|
|
return {
|
|
...state,
|
|
errors: {},
|
|
loading: false,
|
|
data: {
|
|
...state.data,
|
|
[payload.user.id]: payload.user,
|
|
},
|
|
};
|
|
case REQUIRE_PASSWORD_RESET_FAILURE:
|
|
return {
|
|
...state,
|
|
loading: false,
|
|
errors: payload.errors,
|
|
};
|
|
default:
|
|
return config.reducer(state, { type, payload });
|
|
}
|
|
};
|