36 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
		
		
			
		
	
	
			36 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
|  | 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; | ||
|  |           } | ||
|  | 
 | ||
|  |      } | ||
|  | }; |