import { WALLET_GET_COMMISSION_PENDING, WALLET_GET_COMMISSION_SUCCESS, WALLET_TRANSFER_COMMISSION_ERROR, WALLET_TRANSFER_COMMISSION_RESET, WALLET_GET_COMMISSION_ERROR, WALLET_GET_COMMISSION_RESET } from "../types/WalletType";

const initialState = {
     loadingGetCommission: false,
     resultGetCommission: null,
     errorGetCommission: null,
};

export default (state = initialState, action) => {
     switch (action.type) {
          case WALLET_GET_COMMISSION_PENDING: return {
               ...state,
               loadingGetCommission: true
          }
          case WALLET_GET_COMMISSION_SUCCESS: return {
               ...state,
               loadingGetCommission: false,
               resultGetCommission: action.result.data,
               errorGetCommission: null
          }
          case WALLET_GET_COMMISSION_ERROR: return {
               ...state,
               loadingGetCommission: false,
               resultGetCommission: null,
               errorGetCommission: action.result
          }
          case WALLET_GET_COMMISSION_RESET: return initialState;

          default: {
               return state;
          }
     }
};
