ilink-world/redux/reducers/GetDemandsGroupReducer.js

34 lines
1.0 KiB
JavaScript
Raw Normal View History

2020-09-07 16:10:48 +00:00
import { GET_NANO_CREDIT_DEMAND_DETAIL_ERROR, GET_NANO_CREDIT_DEMAND_DETAIL_PENDING, GET_NANO_CREDIT_DEMAND_DETAIL_RESET, GET_NANO_CREDIT_DEMAND_DETAIL_SUCCESS } from "../types/NanoCreditType";
2020-08-12 18:24:56 +00:00
const initialState = {
loading: false,
result: null,
error: null
};
export default (state = initialState, action) => {
switch (action.type) {
2020-09-07 16:10:48 +00:00
case GET_NANO_CREDIT_DEMAND_DETAIL_PENDING: return {
2020-08-12 18:24:56 +00:00
...state,
loading: true
}
2020-09-07 16:10:48 +00:00
case GET_NANO_CREDIT_DEMAND_DETAIL_SUCCESS: return {
2020-08-12 18:24:56 +00:00
...state,
loading: false,
result: action.result.data,
error: null
}
2020-09-07 16:10:48 +00:00
case GET_NANO_CREDIT_DEMAND_DETAIL_ERROR: return {
2020-08-12 18:24:56 +00:00
...state,
loading: false,
result: null,
error: action.result
}
2020-09-07 16:10:48 +00:00
case GET_NANO_CREDIT_DEMAND_DETAIL_RESET: return initialState;
2020-08-12 18:24:56 +00:00
default: {
return state;
}
}
};