电子商城测试版v2
This commit is contained in:
@@ -10,7 +10,8 @@ import {
|
||||
CLEAR_USERINFO,
|
||||
CLEAR_SESSIONKEY,
|
||||
CLEAR_ADMINUSERINFO,
|
||||
CLEAR_SORTCODE
|
||||
CLEAR_SORTCODE,
|
||||
LOGIN_STATUS
|
||||
} from '../constants/userInfo'
|
||||
|
||||
export type UserParam = {
|
||||
@@ -53,6 +54,7 @@ export type DataParam = {
|
||||
userInfo: UserParam,
|
||||
adminUserInfo: UserAdminParam,
|
||||
sort_code: SortCodeParam
|
||||
logingStatus?: false //登录状态 true 正在登录
|
||||
}
|
||||
|
||||
type Action = {
|
||||
@@ -67,6 +69,7 @@ const INIT_USER = {
|
||||
token: Taro.getStorageSync('token')||'',
|
||||
session_key: Taro.getStorageSync('session_key')||'',
|
||||
sort_code: Taro.getStorageSync('sort_code')?JSON.parse(Taro.getStorageSync('sort_code')):null,
|
||||
logingStatus: false
|
||||
}
|
||||
|
||||
export default function counter (state = INIT_USER, action: Action) {
|
||||
@@ -102,6 +105,8 @@ export default function counter (state = INIT_USER, action: Action) {
|
||||
case CLEAR_SORTCODE:
|
||||
Taro.removeStorageSync('sort_code')
|
||||
return {...state, sortCode: null}
|
||||
case LOGIN_STATUS:
|
||||
return {...state, ...data}
|
||||
default:
|
||||
return state
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user