simba-mobile-cad4/app/redux/reducers/GetUserIdentificationReduce...

34 lines
984 B
JavaScript
Raw Permalink Normal View History

2025-01-07 09:47:45 +00:00
import { GET_USER_IDENTIFICATION_PENDING, GET_USER_IDENTIFICATION_SUCCESS, GET_USER_IDENTIFICATION_ERROR, GET_USER_IDENTIFICATION_RESET } from "../types/IdentificationType";
const initialState = {
loading: false,
result: null,
error: null
};
export default (state = initialState, action) => {
switch (action.type) {
case GET_USER_IDENTIFICATION_PENDING: return {
...state,
loading: true
}
case GET_USER_IDENTIFICATION_SUCCESS: return {
...state,
loading: false,
result: action.result.data,
error: null
}
case GET_USER_IDENTIFICATION_ERROR: return {
...state,
loading: false,
result: null,
error: action.result
}
case GET_USER_IDENTIFICATION_RESET: return initialState;
default: {
return state;
}
}
};