UserForm: ajout retour de validation d'API

This commit is contained in:
2020-03-09 11:32:21 +01:00
parent de6832e94f
commit 67732aa00a
11 changed files with 163 additions and 19 deletions

View File

@ -0,0 +1,24 @@
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,
}
};
}