This commit is contained in:
qsh
2024-05-27 15:58:17 +08:00
parent 34b4f84293
commit 1f9be6227c
14 changed files with 173 additions and 43 deletions

View File

@@ -1,15 +1,6 @@
import { store } from '../index'
import { defineStore } from 'pinia'
import {
getAccessToken,
removeToken,
setToken,
getRefreshToken,
getTenantId,
getAppId,
setTenantId,
setAppId
} from '@/utils/auth'
import { getAccessToken, removeToken } from '@/utils/auth'
import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
import { getInfo, loginOut } from '@/api/login'
@@ -86,18 +77,8 @@ export const useUserStore = defineStore('admin-user', {
}
},
refresh() {
const token = getAccessToken()
const refreshToken = getRefreshToken()
const tenantId = getTenantId()
const appId = getAppId()
wsCache.clear()
wsCache.delete(CACHE_KEY.USER)
this.resetState()
setTenantId(tenantId)
setAppId(appId)
setToken({
accessToken: token, // 访问令牌
refreshToken: refreshToken // 刷新令牌
})
window.location.href = ''
}
}