import { WALLET_HISTORY_HYPER_SUPER_PENDING, WALLET_HISTORY_HYPER_SUPER__RESET, WALLET_HISTORY_HYPER_SUPER__ERROR, WALLET_HISTORY_HYPER_SUPER__SUCCESS } from "../types/WalletType";

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

export default (state = initialState, action) => {
     switch (action.type) {
          case WALLET_HISTORY_HYPER_SUPER_PENDING: return {
               ...state,
               loading: true
          }
          case WALLET_HISTORY_HYPER_SUPER__SUCCESS: return {
               ...state,
               loading: false,
               result: action.result.data,
               error: null
          }
          case WALLET_HISTORY_HYPER_SUPER__ERROR: return {
               ...state,
               loading: false,
               result: null,
               error: action.result
          }
          case WALLET_HISTORY_HYPER_SUPER__RESET: return initialState;

          default: {
               return state;
          }
     }
};
