import { WALLET_TRANSFER_COMMISSION_PENDING, WALLET_TRANSFER_COMMISSION_SUCCESS, WALLET_TRANSFER_COMMISSION_ERROR, WALLET_TRANSFER_COMMISSION_RESET } from "../types/WalletType";

const initialState = {
     loadingTransferCommission: false,
     resultTransferCommission: null,
     errorTransferCommission: null,
};

export default (state = initialState, action) => {
     switch (action.type) {
          case WALLET_TRANSFER_COMMISSION_PENDING: return {
               ...state,
               loadingTransferCommission: true
          }
          case WALLET_TRANSFER_COMMISSION_SUCCESS: return {
               ...state,
               loadingTransferCommission: false,
               resultTransferCommission: action.result.data,
               errorTransferCommission: null
          }
          case WALLET_TRANSFER_COMMISSION_ERROR: return {
               ...state,
               loadingTransferCommission: false,
               resultTransferCommission: null,
               errorTransferCommission: action.result
          }

          case WALLET_TRANSFER_COMMISSION_RESET: return initialState;

          default: {
               return state;
          }

     }
};
