|
@ -1,7 +1,7 @@ |
|
|
// src/utils/request.js
|
|
|
// src/utils/request.js
|
|
|
import axios from "axios"; |
|
|
import axios from "axios"; |
|
|
import { handleTokenRefresh } from '@/utils/loginRefresh'; |
|
|
import { handleTokenRefresh } from '@/utils/loginRefresh'; |
|
|
import { host } from '@/config/host'; |
|
|
// import { host } from '@/config/host';
|
|
|
|
|
|
|
|
|
// 创建 axios 实例
|
|
|
// 创建 axios 实例
|
|
|
const service = axios.create({ |
|
|
const service = axios.create({ |
|
@ -53,7 +53,7 @@ service.interceptors.response.use( |
|
|
switch (error.response.status) { |
|
|
switch (error.response.status) { |
|
|
case 401: |
|
|
case 401: |
|
|
// 未授权,跳转到登录页
|
|
|
// 未授权,跳转到登录页
|
|
|
window.location.href = host; |
|
|
window.location.href = "/"; |
|
|
break; |
|
|
break; |
|
|
case 402: |
|
|
case 402: |
|
|
// token失效
|
|
|
// token失效
|
|
|