24 lines
545 B
JavaScript
24 lines
545 B
JavaScript
import { CREATE_USER_FAILURE } from '../actions/user.actions';
|
|
|
|
const initialState = {
|
|
byId: {},
|
|
createUserForm: { errorCode: null },
|
|
};
|
|
|
|
export function usersReducer(state = initialState, action) {
|
|
switch(action.type) {
|
|
case CREATE_USER_FAILURE:
|
|
return handleCreateUserFailure(state, action);
|
|
}
|
|
return state;
|
|
}
|
|
|
|
function handleCreateUserFailure(state, { error }) {
|
|
return {
|
|
...state,
|
|
createUserForm: {
|
|
...state.createUserForm,
|
|
errorCode: error.code,
|
|
}
|
|
};
|
|
} |