...
|
...
|
@@ -12,6 +12,17 @@ import Immutable, {List, Record} from 'immutable'; |
|
|
const {
|
|
|
|
|
|
LOGOUT,
|
|
|
DELIVERY_GOODS_REQUEST,
|
|
|
DELIVERY_GOODS_SUCCESS,
|
|
|
DELIVERY_GOODS_FAILURE,
|
|
|
|
|
|
GET_EXPRESS_LIST_REQUEST,
|
|
|
GET_EXPRESS_LIST_SUCCESS,
|
|
|
GET_EXPRESS_LIST_FAILURE,
|
|
|
|
|
|
QUERYBYSUPPLIER_REQUEST,
|
|
|
QUERYBYSUPPLIER_SUCCESS,
|
|
|
QUERYBYSUPPLIER_FAILURE,
|
|
|
|
|
|
} = require('../../constants/actionTypes').default;
|
|
|
|
...
|
...
|
@@ -26,9 +37,46 @@ export default function userReducer(state = initialState, action) { |
|
|
if (!(state instanceof InitialState)) return initialState.merge(state);
|
|
|
|
|
|
switch (action.type) {
|
|
|
case LOGOUT:{
|
|
|
case DELIVERY_GOODS_REQUEST:{
|
|
|
return state;
|
|
|
}
|
|
|
case DELIVERY_GOODS_SUCCESS:{
|
|
|
return state;
|
|
|
}
|
|
|
case DELIVERY_GOODS_FAILURE:{
|
|
|
return state;
|
|
|
}
|
|
|
case GET_EXPRESS_LIST_REQUEST:{
|
|
|
return state.setIn(['expressList', 'isFetching'], true)
|
|
|
.setIn(['expressList', 'error'], null);
|
|
|
}
|
|
|
case GET_EXPRESS_LIST_SUCCESS:{
|
|
|
return state.setIn(['expressList', 'isFetching'], false)
|
|
|
.setIn(['expressList', 'error'], null)
|
|
|
.setIn(['expressList', 'list'], Immutable.fromJS(action.payload));
|
|
|
}
|
|
|
case GET_EXPRESS_LIST_FAILURE:{
|
|
|
return state.setIn(['expressList', 'isFetching'], false)
|
|
|
.setIn(['expressList', 'error'], action.payload);
|
|
|
}
|
|
|
case QUERYBYSUPPLIER_REQUEST:{
|
|
|
return state.setIn(['storehouse', 'isFetching'], true)
|
|
|
.setIn(['storehouse', 'error'], null);
|
|
|
}
|
|
|
case QUERYBYSUPPLIER_FAILURE:{
|
|
|
return state.setIn(['storehouse', 'isFetching'], false)
|
|
|
.setIn(['storehouse', 'adminName'], action.payload.adminName)
|
|
|
.setIn(['storehouse', 'address'], action.payload.address)
|
|
|
.setIn(['storehouse', 'phone'], action.payload.phone)
|
|
|
.setIn(['storehouse', 'storehouseName'], action.payload.storehouseName)
|
|
|
.setIn(['storehouse', 'id'], action.payload.id)
|
|
|
.setIn(['storehouse', 'status'], action.payload.status)
|
|
|
.setIn(['storehouse', 'error'], null)
|
|
|
}
|
|
|
case GET_EXPRESS_LIST_FAILURE:{
|
|
|
return state.setIn(['storehouse', 'isFetching'], false)
|
|
|
.setIn(['storehouse', 'error'], action.payload);
|
|
|
}
|
|
|
return state;
|
|
|
}
|
|
|
|
...
|
...
|
|