...
|
...
|
@@ -4,11 +4,11 @@ import InitialState from './messageInitialState'; |
|
|
import Immutable, {Map} from 'immutable';
|
|
|
|
|
|
const {
|
|
|
LATEST_MESSAGE_REQUEST,
|
|
|
LATEST_MESSAGE_REQUEST,
|
|
|
LATEST_MESSAGE_SUCCESS,
|
|
|
LATEST_MESSAGE_FAILURE,
|
|
|
|
|
|
MESSAGE_CATEGORY_SELECT,
|
|
|
MESSAGE_CATEGORY_SELECT,
|
|
|
|
|
|
} = require('../../constants/actionTypes').default;
|
|
|
|
...
|
...
|
@@ -18,33 +18,33 @@ export default function messageReducer(state=initialState, action) { |
|
|
switch(action.type) {
|
|
|
case LATEST_MESSAGE_REQUEST: {
|
|
|
return state.setIn(['latest', 'isFetching'], true)
|
|
|
.setIn(['latest', 'error'], null);
|
|
|
.setIn(['latest', 'error'], null);
|
|
|
}
|
|
|
|
|
|
case LATEST_MESSAGE_SUCCESS: {
|
|
|
let onlineService = {
|
|
|
id: 99,
|
|
|
inboxCatName: '在线客服',
|
|
|
content: '服务时间:08:00-22:30',
|
|
|
unReadCount:0,
|
|
|
createTime:'',
|
|
|
imageUrl: '',
|
|
|
};
|
|
|
let list = action.payload.list;
|
|
|
list = [...list,onlineService];
|
|
|
let onlineService = {
|
|
|
id: 99,
|
|
|
inboxCatName: '在线客服',
|
|
|
content: '服务时间:08:00-22:30',
|
|
|
unReadCount:0,
|
|
|
createTime:'',
|
|
|
imageUrl: '',
|
|
|
};
|
|
|
let list = action.payload.list;
|
|
|
list = [...list,onlineService];
|
|
|
return state.setIn(['latest', 'isFetching'], false)
|
|
|
.setIn(['latest', 'data'], Immutable.fromJS(list))
|
|
|
.setIn(['latest', 'error'], null);
|
|
|
}
|
|
|
|
|
|
case LATEST_MESSAGE_FAILURE: {
|
|
|
return state.setIn(['latest', 'isFetching'], false)
|
|
|
.setIn(['latest', 'error'], action.payload);
|
|
|
}
|
|
|
|
|
|
case MESSAGE_CATEGORY_SELECT: {
|
|
|
return state.setIn(['latest', 'data'], Immutable.fromJS(action.payload));
|
|
|
}
|
|
|
.setIn(['latest', 'data'], Immutable.fromJS(list))
|
|
|
.setIn(['latest', 'error'], null);
|
|
|
}
|
|
|
|
|
|
case LATEST_MESSAGE_FAILURE: {
|
|
|
return state.setIn(['latest', 'isFetching'], false)
|
|
|
.setIn(['latest', 'error'], action.payload);
|
|
|
}
|
|
|
|
|
|
case MESSAGE_CATEGORY_SELECT: {
|
|
|
return state.setIn(['latest', 'data'], Immutable.fromJS(action.payload));
|
|
|
}
|
|
|
}
|
|
|
return state;
|
|
|
} |
...
|
...
|
|