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

36 lines
1.0 KiB
JavaScript
Raw Normal View History

2020-05-01 22:36:24 +00:00
import { TREAT_CREDIT_DEMAND_PENDING, TREAT_CREDIT_DEMAND_RESET, TREAT_CREDIT_DEMAND_SUCCESS, TREAT_CREDIT_DEMAND_ERROR } from "../types/CreditManageType";
const initialState = {
loadingTreatDemand: false,
resultTreatDemand: null,
errorTreatDemand: null,
};
export default (state = initialState, action) => {
switch (action.type) {
case TREAT_CREDIT_DEMAND_PENDING: return {
...state,
loadingTreatDemand: true
}
case TREAT_CREDIT_DEMAND_SUCCESS: return {
...state,
loadingTreatDemand: false,
resultTreatDemand: action.result.data,
errorTreatDemand: null
}
case TREAT_CREDIT_DEMAND_ERROR: return {
...state,
loadingTreatDemand: false,
resultTreatDemand: null,
errorTreatDemand: action.result
}
case TREAT_CREDIT_DEMAND_RESET: return initialState;
default: {
return state;
}
}
};