ilink-world/redux/reducers/PayBillReducer.js

38 lines
898 B
JavaScript
Raw Normal View History

2020-11-27 09:28:47 +00:00
import {PAY_BILL_ERROR, PAY_BILL_PENDING, PAY_BILL_RESET, PAY_BILL_SUCCESS} from "../types/WalletType";
const initialState = {
loading: false,
result: null,
error: null
};
export default (state = initialState, action) => {
switch (action.type) {
case PAY_BILL_PENDING:
return {
...state,
loading: true
}
case PAY_BILL_SUCCESS:
return {
...state,
loading: false,
result: action.result.data,
error: null
}
case PAY_BILL_ERROR:
return {
...state,
loading: false,
result: null,
error: action.result
}
case PAY_BILL_RESET:
return initialState;
default: {
return state;
}
}
};