ilink-world/app/redux/reducers/GetBankListReducer.js

43 lines
954 B
JavaScript
Executable File

import {
GET_BANK_LIST_ERROR,
GET_BANK_LIST_PENDING,
GET_BANK_LIST_RESET,
GET_BANK_LIST_SUCCESS
} from "../types/BankType";
const initialState = {
loading: false,
result: null,
error: null
};
export default (state = initialState, action) => {
switch (action.type) {
case GET_BANK_LIST_PENDING:
return {
...state,
loading: true
}
case GET_BANK_LIST_SUCCESS:
return {
...state,
loading: false,
result: action.result.data,
error: null
}
case GET_BANK_LIST_ERROR:
return {
...state,
loading: false,
result: null,
error: action.result
}
case GET_BANK_LIST_RESET:
return initialState;
default: {
return state;
}
}
};