simba-mobile-cad3/app/redux/reducers/CreditCancelDemandReducer.js

36 lines
1.0 KiB
JavaScript
Raw Normal View History

2025-01-07 09:47:45 +00:00
import { TREAT_CREDIT_CANCEL_PENDING, TREAT_CREDIT_CANCEL_SUCCESS, TREAT_CREDIT_CANCEL_ERROR, TREAT_CREDIT_CANCEL_RESET } from "../types/CreditManageType";
const initialState = {
loadingCancelDemand: false,
resultCancelDemand: null,
errorCancelDemand: null,
};
export default (state = initialState, action) => {
switch (action.type) {
case TREAT_CREDIT_CANCEL_PENDING: return {
...state,
loadingCancelDemand: true
}
case TREAT_CREDIT_CANCEL_SUCCESS: return {
...state,
loadingCancelDemand: false,
resultCancelDemand: action.result.data,
errorCancelDemand: null
}
case TREAT_CREDIT_CANCEL_ERROR: return {
...state,
loadingCancelDemand: false,
resultCancelDemand: null,
errorCancelDemand: action.result
}
case TREAT_CREDIT_CANCEL_RESET: return initialState;
default: {
return state;
}
}
};