如果有token,就不允许跳转到登录页了

This commit is contained in:
宇阳
2024-08-04 19:17:14 +08:00
parent 63cd5cfb30
commit 5c312aedbd
6 changed files with 67 additions and 21 deletions

View File

@@ -21,6 +21,8 @@ instance.interceptors.request.use(
(config: InternalAxiosRequestConfig) => {
const token = store.token
if(config.method === "get") return config
// 如果有token就把赋值给请求头
if (token) config.headers["Authorization"] = `Bearer ${token}`;