1234567891011121314151617181920212223242526272829303132333435 |
- import * as actionTypes from '../../../constants/admin';
- import initialState from '../../initialState';
- export default function changeUserReducer(state = initialState.changeUser, { type, payload }) {
- switch (type) {
- case actionTypes.CHANGE_USERS_REQUEST: {
- return {
- ...state,
- isFetching: false,
- payload
- }
- }
- case actionTypes.CHANGE_USERS_REQUEST_SUCCESS: {
- const { data:{user} } = payload;
- return {
- ...state,
- isFetching: true,
- data:user
- }
- }
- case actionTypes.CHANGE_USERS_REQUEST_FAILURE: {
- const { error } = payload;
- return {
- ...state,
- isFetching: false,
- error
- }
- }
- default: {
- return state;
- }
- }
- }
|