|
@@ -6,6 +6,7 @@ import { ElMessage } from 'element-plus';
|
|
import { isNil } from 'lodash';
|
|
import { isNil } from 'lodash';
|
|
import { baseURL } from '@/sheep/config';
|
|
import { baseURL } from '@/sheep/config';
|
|
import { apiRouting } from '@/sheep/config/api-routing';
|
|
import { apiRouting } from '@/sheep/config/api-routing';
|
|
|
|
+import { getCurrentLanguage } from '@/locales';
|
|
|
|
|
|
const options = {
|
|
const options = {
|
|
// 显示操作成功消息 默认不显示
|
|
// 显示操作成功消息 默认不显示
|
|
@@ -80,6 +81,11 @@ request.interceptors.request.use(
|
|
const token = $storage.get('token');
|
|
const token = $storage.get('token');
|
|
if (token) config.headers['Accesstoken'] = token;
|
|
if (token) config.headers['Accesstoken'] = token;
|
|
|
|
|
|
|
|
+ // 添加语言请求头
|
|
|
|
+ const currentLanguage = getCurrentLanguage();
|
|
|
|
+ const languageCode = currentLanguage === 'en-US' ? 'en' : 'zh';
|
|
|
|
+ config.headers['language'] = languageCode;
|
|
|
|
+
|
|
// 🔑 API路由处理
|
|
// 🔑 API路由处理
|
|
const processedConfig = apiRouting.processRequest(config);
|
|
const processedConfig = apiRouting.processRequest(config);
|
|
|
|
|