fix 一些问题

This commit is contained in:
2021-06-20 21:06:50 +08:00
parent c694078569
commit ada758e4db
10 changed files with 188 additions and 133 deletions

View File

@@ -1,9 +1,13 @@
const nav = (state = { nav: [] }, action) => {
const defaultState = { nav: [] }
const nav = (state = defaultState, action) => {
// 写入各种action对应的操作
switch (action.type) {
case 'SET_ANV':
case 'SET_NAV':
const _state = { ...state, nav: action.nav }
return _state
case 'RESET_NAV':
return defaultState
default:
return state
}

View File

@@ -1,9 +1,13 @@
const user = (state = {}, action) => {
const defaultState = {}
const user = (state = defaultState, action) => {
// 写入各种action对应的操作
switch (action.type) {
case 'SET_USER_ACCOUNT':
const _state = { ...state, ...action.user }
return _state
case 'RESET_USER_ACCOUNT':
return defaultState
default:
return state
}