src/common/utils/request.ts | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/common/utils/request.ts
@@ -2,6 +2,7 @@ import type { AxiosRequestConfig } from 'axios' import { ElMessage } from 'element-plus' import { getToken } from '@/common/utils/index' import router from '../../router/index' const instance = axiosClient.create({ responseType: 'json', @@ -17,6 +18,9 @@ const token = getToken() if (token) { config.headers.Authorization = 'Bearer ' + token } else { router.push('/login') // window.location = `//${window.location.hostname}:9080`+'/login' } return config