mirror of
https://github.com/YMFE/yapi.git
synced 2024-12-27 05:30:14 +08:00
33 lines
587 B
JavaScript
33 lines
587 B
JavaScript
import {
|
|
FETCH_GROUP_LIST,
|
|
SET_CURR_GROUP
|
|
} from '../../constants/action-types';
|
|
|
|
const initialState = {
|
|
groupList: [],
|
|
currGroup: { group_name: '' }
|
|
};
|
|
|
|
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 SET_CURR_GROUP: {
|
|
return {
|
|
...state,
|
|
currGroup: action.payload
|
|
};
|
|
}
|
|
|
|
default:
|
|
return state;
|
|
}
|
|
};
|