import { RETRAIT_CASH_AGENT_ID_VERIFICATION_PENDING, RETRAIT_CASH_AGENT_ID_VERIFICATION_SUCCESS, RETRAIT_CASH_AGENT_ID_VERIFICATION_ERROR, RETRAIT_CASH_AGENT_ID_VERIFICATION_RESET } from "../types/EnvoieAgentType";

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

export default (state = initialState, action) => {
     switch (action.type) {
          case RETRAIT_CASH_AGENT_ID_VERIFICATION_PENDING: return {
               ...state,
               loading: true
          }
          case RETRAIT_CASH_AGENT_ID_VERIFICATION_SUCCESS: return {
               ...state,
               loading: false,
               result: action.result.data,
               error: null
          }
          case RETRAIT_CASH_AGENT_ID_VERIFICATION_ERROR: return {
               ...state,
               loading: false,
               result: null,
               error: action.result
          }
          case RETRAIT_CASH_AGENT_ID_VERIFICATION_RESET: return initialState;

          default: {
               return state;
          }
     }
};
