Merge remote-tracking branch 'origin/main'

perf/export-docx
Lei OT 12 months ago
commit 05bbfaf49f

@ -64,6 +64,8 @@ const useAuthStore = create((set, get) => ({
const { startTokenInterval, loadUserPermission } = get() const { startTokenInterval, loadUserPermission } = get()
const { setStorage, loginToken } = usingStorage() const { setStorage, loginToken } = usingStorage()
// Dev 模式使用 localStorage会有 token 失效情况,需要手动删除
// Prod 环境没有该问题
const userJson = await fetchUserDetail(loginToken) const userJson = await fetchUserDetail(loginToken)
appendRequestParams('token', loginToken) appendRequestParams('token', loginToken)
@ -142,9 +144,9 @@ const useAuthStore = create((set, get) => ({
async function checkTokenTimeout() { async function checkTokenTimeout() {
// TODOToken 失效后要跳转到登录页面 // TODOToken 失效后要跳转到登录页面
const { LastReqDate } = await fetchLastRequet() const { LastReqDate } = await fetchLastRequet()
const lastReqDate = new Date(LastReqDate) const lastReqDateTime = new Date(LastReqDate).getTime()
const now = new Date() const now = new Date()
const diffTime = now.getTime() - lastReqDate.getTime() const diffTime = now.getTime() - lastReqDateTime
const diffHours = diffTime/1000/60/60 const diffHours = diffTime/1000/60/60
if (diffHours > 1) { if (diffHours > 1) {
logout() logout()

Loading…
Cancel
Save