|
@@ -139,6 +139,9 @@ const transform: AxiosTransform = {
|
|
|
requestInterceptors: (config, options) => {
|
|
|
// 请求之前处理config
|
|
|
const token = getToken();
|
|
|
+ const { locale } = useI18n();
|
|
|
+ const lang = locale == 'zh-CN' ? 'zh' : 'en';
|
|
|
+ console.log('locale', locale);
|
|
|
if (token && (config as Recordable)?.requestOptions?.withToken !== false) {
|
|
|
// jwt token
|
|
|
(config as Recordable).headers.Authorization = options.authenticationScheme
|
|
@@ -148,6 +151,9 @@ const transform: AxiosTransform = {
|
|
|
? `${options.authenticationScheme} ${token}`
|
|
|
: token;
|
|
|
}
|
|
|
+ if (lang) {
|
|
|
+ (config as Recordable).headers.lang = lang;
|
|
|
+ }
|
|
|
return config;
|
|
|
},
|
|
|
|