import { GET_NUMBER_DETAIL_PENDING, GET_NUMBER_DETAIL_SUCCESS, GET_NUMBER_DETAIL_ERROR, GET_NUMBER_DETAIL_RESET } from "../types/IdentificationType";

const initialState = {
     loading: false,
     result: null,
     error: null
};

export default (state = initialState, action) => {
     switch (action.type) {
          case GET_NUMBER_DETAIL_PENDING: return {
               ...state,
               loading: true
          }
          case GET_NUMBER_DETAIL_SUCCESS: return {
               ...state,
               loading: false,
               result: action.result.data,
               error: null
          }
          case GET_NUMBER_DETAIL_ERROR: return {
               ...state,
               loading: false,
               result: null,
               error: action.result
          }
          case GET_NUMBER_DETAIL_RESET: return initialState;

          default: {
               return state;
          }
     }
};
