fork from bc4552c5a8
This commit is contained in:
26
client/reducer/modules/menu.js
Normal file
26
client/reducer/modules/menu.js
Normal file
@@ -0,0 +1,26 @@
|
||||
// Actions
|
||||
const CHANGE_MENU_ITEM = 'yapi/menu/CHANGE_MENU_ITEM';
|
||||
|
||||
// Reducer
|
||||
const initialState = {
|
||||
curKey: '/' + window.location.hash.split('/')[1]
|
||||
};
|
||||
|
||||
export default (state = initialState, action) => {
|
||||
if (action.type === CHANGE_MENU_ITEM) {
|
||||
return {
|
||||
...state,
|
||||
curKey: action.data
|
||||
};
|
||||
} else {
|
||||
return state;
|
||||
}
|
||||
};
|
||||
|
||||
// Action Creators
|
||||
export function changeMenuItem(curKey) {
|
||||
return {
|
||||
type: CHANGE_MENU_ITEM,
|
||||
data: curKey
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user