yapi/client/reducer/group/group.js
2017-07-14 15:15:59 +08:00

36 lines
651 B
JavaScript

import {
FETCH_GROUP_LIST,
FETCH_CURR_GROUP
} from '../../constants/action-types';
const initialState = {
groupList: [],
currGroup: 'MFE'
};
export default (state = initialState, action) => {
switch (action.type) {
case FETCH_GROUP_LIST: {
if (!action.payload.data.errcode) {
return {
...state,
groupList: action.payload.data.data
};
}
return state;
}
case FETCH_CURR_GROUP: {
if (action.payload.res) {
return {
...state,
currGroup: action.payload.data
};
}
return state;
}
default:
return state;
}
};