perf: 修改 token

This commit is contained in:
ibuler 2022-05-12 15:42:57 +08:00 committed by 老广
parent 0b5820edba
commit ee901e54d3

View File

@ -22,7 +22,7 @@ async function checkLogin({ to, from, next }) {
}
// Determine whether the user has logged in
const hasToken = getTokenFromCookie()
if (!hasToken) {
if (!hasToken || hasToken === 'null') {
request.get(process.env['VUE_APP_LOGOUT_PATH']).finally(() => {
window.location = process.env.VUE_APP_LOGIN_PATH
})
@ -47,7 +47,7 @@ function afterGetSetting(setting) {
if (setting['SESSION_EXPIRE_AT_BROWSER_CLOSE']) {
setInterval(() => {
const csrfToken = getTokenFromCookie()
setTokenToCookie(csrfToken, '30s')
if (csrfToken) { setTokenToCookie(csrfToken, '30s') }
}, 10 * 1000)
}
}