import {
    GET_BANK_FOR_ILINK_ERROR,
    GET_BANK_FOR_ILINK_PENDING,
    GET_BANK_FOR_ILINK_RESET,
    GET_BANK_FOR_ILINK_SUCCESS
} from "../types/WalletType";

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

export default (state = initialState, action) => {
    switch (action.type) {
        case GET_BANK_FOR_ILINK_PENDING:
            return {
                ...state,
                loading: true
            }
        case GET_BANK_FOR_ILINK_SUCCESS:
            return {
                ...state,
                loading: false,
                result: action.result.data,
                error: null
            }
        case GET_BANK_FOR_ILINK_ERROR:
            return {
                ...state,
                loading: false,
                result: null,
                error: action.result
            }
        case GET_BANK_FOR_ILINK_RESET:
            return initialState;

        default: {
            return state;
        }
    }
};
