Commit 94c22462 authored by 乐宝呗666's avatar 乐宝呗666

修改token过期的问题

parent 4e6f85c0
This diff is collapsed.
...@@ -99,9 +99,9 @@ const httpServer = (opts, data, file, timeout) => { ...@@ -99,9 +99,9 @@ const httpServer = (opts, data, file, timeout) => {
let authToken = ""; let authToken = "";
if (opts.authType && opts.authType != "") { if (opts.authType && opts.authType != "") {
if (opts.authType === "back") { if (opts.authType === "back") {
authToken =sessionStorage.getItem('sToken') || "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsInVzZXJfaWQiOiIxIiwiaXNzIjoiSUFUQSIsImV4cCI6MTYxNjY2NTkzOCwiaWF0IjoxNjE2NjUxNTM4fQ._nqZq0LMwkurIBKJtfX-imXLCxQSNwJ-ueGZ8iwW-0oAW880gY7PjNEfroYYQZ91v0u5yQb73Alzvy6EIp6GGg" authToken =sessionStorage.getItem('token') || "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsInVzZXJfaWQiOiIxIiwiaXNzIjoiSUFUQSIsImV4cCI6MTYxNjY2NTkzOCwiaWF0IjoxNjE2NjUxNTM4fQ._nqZq0LMwkurIBKJtfX-imXLCxQSNwJ-ueGZ8iwW-0oAW880gY7PjNEfroYYQZ91v0u5yQb73Alzvy6EIp6GGg"
} else if (opts.authType === "front") { } else if (opts.authType === "front") {
authToken = sessionStorage.getItem("sToken"); authToken = sessionStorage.getItem("token");
} }
httpDefaultOpts.headers["Authorization"] = authToken httpDefaultOpts.headers["Authorization"] = authToken
} }
...@@ -109,7 +109,7 @@ const httpServer = (opts, data, file, timeout) => { ...@@ -109,7 +109,7 @@ const httpServer = (opts, data, file, timeout) => {
delete httpDefaultOpts.data delete httpDefaultOpts.data
httpDefaultOpts.params.timestamp_static = new Date().getTime(); httpDefaultOpts.params.timestamp_static = new Date().getTime();
} else { } else {
// delete httpDefaultOpts.params delete httpDefaultOpts.params
if (file) { if (file) {
httpDefaultOpts.data = data; httpDefaultOpts.data = data;
} }
...@@ -134,8 +134,8 @@ const httpServer = (opts, data, file, timeout) => { ...@@ -134,8 +134,8 @@ const httpServer = (opts, data, file, timeout) => {
message: '您的登录过期,请重新登录!', message: '您的登录过期,请重新登录!',
onClose: () => { onClose: () => {
//这个时候点击确定后清除用户信息 //这个时候点击确定后清除用户信息
sessionStorage.removeItem('sToken') sessionStorage.removeItem('token')
sessionStorage.removeItem('sUserInfo') sessionStorage.removeItem('userInfo')
router.push({ router.push({
path: '/', path: '/',
query: { query: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment