|
|
@ -12,7 +12,7 @@ const service = axios.create({ |
|
|
|
// 请求拦截
|
|
|
|
// 请求拦截
|
|
|
|
service.interceptors.request.use( |
|
|
|
service.interceptors.request.use( |
|
|
|
(config) => { |
|
|
|
(config) => { |
|
|
|
let token = localStorage.getItem("token"); |
|
|
|
let token = localStorage.getItem("customerToken"); |
|
|
|
|
|
|
|
|
|
|
|
if (token) { |
|
|
|
if (token) { |
|
|
|
config.headers["Authorization"] = token; |
|
|
|
config.headers["Authorization"] = token; |
|
|
@ -63,7 +63,7 @@ service.interceptors.response.use( |
|
|
|
if (res && res.code) { |
|
|
|
if (res && res.code) { |
|
|
|
if (res.code === 42011) { |
|
|
|
if (res.code === 42011) { |
|
|
|
Vue.prototype.$message.error(res.msg || "您的登录已失效,请重新登录"); |
|
|
|
Vue.prototype.$message.error(res.msg || "您的登录已失效,请重新登录"); |
|
|
|
localStorage.removeItem("token"); |
|
|
|
localStorage.removeItem("removeItem"); |
|
|
|
setTimeout(() => { |
|
|
|
setTimeout(() => { |
|
|
|
window.location.reload(); |
|
|
|
window.location.reload(); |
|
|
|
}, 1000); |
|
|
|
}, 1000); |
|
|
|