From 3fb8f1c2516f8e56ec9406426ccb4764c6c50968 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子Li <15040126243@163.com> Date: 星期日, 02 七月 2023 15:32:58 +0800 Subject: [PATCH] 回退 'Pull Request !20 : 统一登录授权' --- src/utils/request.ts | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/utils/request.ts b/src/utils/request.ts index af73926..d5fac4e 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -7,14 +7,13 @@ import { errorCode } from '@/utils/errorCode'; import { LoadingInstance } from 'element-plus/es/components/loading/src/loading'; import FileSaver from 'file-saver'; +import { getLanguage } from '@/lang'; let downloadLoadingInstance: LoadingInstance; // 鏄惁鏄剧ず閲嶆柊鐧诲綍 export const isRelogin = { show: false }; axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'; -// 瀵瑰簲鍥介檯鍖栬祫婧愭枃浠跺悗缂� -axios.defaults.headers['Content-Language'] = 'zh_CN'; // 鍒涘缓 axios 瀹炰緥 const service = axios.create({ baseURL: import.meta.env.VITE_APP_BASE_API, @@ -24,6 +23,9 @@ // 璇锋眰鎷︽埅鍣� service.interceptors.request.use( (config: InternalAxiosRequestConfig) => { + // 瀵瑰簲鍥介檯鍖栬祫婧愭枃浠跺悗缂� + config.headers['Content-Language'] = getLanguage(); + const isToken = (config.headers || {}).isToken === false; // 鏄惁闇�瑕侀槻姝㈡暟鎹噸澶嶆彁浜� const isRepeatSubmit = (config.headers || {}).repeatSubmit === false; -- Gitblit v1.9.3