File tree 1 file changed +5
-0
lines changed
1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ export const state = () => ({
6
6
// 这两个用于client side的使用, 又放cookie里是为了刷新时状态不丢失
7
7
userId : '' ,
8
8
token : '' ,
9
+ tenantId : '' ,
9
10
meta : { } ,
10
11
11
12
user : { } ,
@@ -18,19 +19,23 @@ export const mutations = {
18
19
login ( state , payload ) {
19
20
state . token = payload . key
20
21
state . userId = payload . id
22
+ state . tenantId = payload . tenantId
21
23
22
24
// 部署不一定是在根路径, 所以cookie要设置path
23
25
let path = this . $router . options . base
24
26
cookie . set ( 'token' , payload . key , { path} )
25
27
cookie . set ( 'userId' , payload . id , { path} )
28
+ cookie . set ( 'tenantId' , payload . tenantId , { path} )
26
29
} ,
27
30
logout ( state ) {
28
31
state . token = ''
29
32
state . userId = ''
33
+ state . tenantId = ''
30
34
31
35
let path = this . $router . options . base
32
36
cookie . remove ( 'token' , { path} )
33
37
cookie . remove ( 'userId' , { path} )
38
+ cookie . remove ( 'tenantId' , { path} )
34
39
} ,
35
40
update ( state , payload ) {
36
41
Object . keys ( payload ) . forEach ( k => {
You can’t perform that action at this time.
0 commit comments