import { WALLET_LIST_DETAIL_PENDING, WALLET_LIST_DETAIL_SUCCESS, WALLET_LIST_DETAIL_ERROR, WALLET_LIST_DETAIL_RESET } from "../types/WalletType";

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

export default (state = initialState, action) => {
     switch (action.type) {
          case WALLET_LIST_DETAIL_PENDING: return {
               ...state,
               loading: true
          }
          case WALLET_LIST_DETAIL_SUCCESS: return {
               ...state,
               loading: false,
               result: action.result.data,
               error: null
          }
          case WALLET_LIST_DETAIL_ERROR: return {
               ...state,
               loading: false,
               result: null,
               error: action.result
          }
          case WALLET_LIST_DETAIL_RESET: return initialState;

          default: {
               return state;
          }

     }
};
