Skip to content

Commit db7ace9

Browse files
author
levy9527
committed
Accept Merge Request levy9527#5: (hotfix-store-tenantId -> master)
Merge Request: fix store未保存tenantId Created By: @Alvin-Liu Accepted By: @levy9527 URL: https://coding.net/u/shaowin/p/optimus-nuxt/git/merge/5
2 parents bd08f57 + ec05606 commit db7ace9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/store/index.js

+5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export const state = () => ({
66
// 这两个用于client side的使用, 又放cookie里是为了刷新时状态不丢失
77
userId: '',
88
token: '',
9+
tenantId: '',
910
meta: {},
1011

1112
user: {},
@@ -18,19 +19,23 @@ export const mutations = {
1819
login(state, payload) {
1920
state.token = payload.key
2021
state.userId = payload.id
22+
state.tenantId = payload.tenantId
2123

2224
// 部署不一定是在根路径, 所以cookie要设置path
2325
let path = this.$router.options.base
2426
cookie.set('token', payload.key, {path})
2527
cookie.set('userId', payload.id, {path})
28+
cookie.set('tenantId', payload.tenantId, {path})
2629
},
2730
logout(state) {
2831
state.token = ''
2932
state.userId = ''
33+
state.tenantId = ''
3034

3135
let path = this.$router.options.base
3236
cookie.remove('token', {path})
3337
cookie.remove('userId', {path})
38+
cookie.remove('tenantId', {path})
3439
},
3540
update(state, payload) {
3641
Object.keys(payload).forEach(k => {

0 commit comments

Comments
 (0)