yapi/client/reducer/group/group.js
2017-07-19 15:32:51 +08:00

36 lines
683 B
JavaScript

import {
FETCH_GROUP_LIST,
SET_CURR_GROUP
} from '../../constants/action-types';
import { message } from 'antd'
const initialState = {
groupList: [],
currGroup: { group_name: '' }
};
export default (state = initialState, action) => {
switch (action.type) {
case FETCH_GROUP_LIST: {
if (action.payload.data.errcode) {
message.error(action.payload.data.errmsg);
} else {
return {
...state,
groupList: action.payload.data.data
};
}
return state;
}
case SET_CURR_GROUP: {
return {
...state,
currGroup: action.payload
};
}
default:
return state;
}
};