项目中使用了token验证用户,我在NuxtServerInit中写入了将用户存储在Node的Session中的token写入到Store中,也就是说,用户登录后,有三个地方存储token,Node服务器中的Session、Store和本地localStorage,现在的问题是,当用户在其他地方登录,原token失效,刷新页面后,我需要在axios的响应拦截器中对这些数据进行处理,如果返回的code是10004,则清除本地、Store和Node服务器Session中存储的token,但问题是如何在axios中访问Node服务器中的session??下面是代码
import axios from 'axios'
import { handleRequestParams, handleWebStorage } from '@/utils/utils'
import { WEBSTORAGE_TOKEN_NAME } from '@/config/config'
import state from '@/store/state'
import { apiByENV } from '@/config/config'
const Axios = axios.create({
baseURL: apiByENV,
timeout: 5000,
headers: {
"Content-Type": "application/x-www-form-urlencoded;charset=utf-8"
}
})
// h