From 7eccfd6877d6c6e5682d801e9169cc4ea45e308d Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Wed, 8 Nov 2023 18:17:30 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BB=8E=E5=AE=A2=E6=88=B7=E7=AB=AF?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E9=A6=96=E9=80=89=E8=AF=AD=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/http-fetch.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/plugins/http-fetch.ts b/src/plugins/http-fetch.ts index 1eee7479..56379005 100644 --- a/src/plugins/http-fetch.ts +++ b/src/plugins/http-fetch.ts @@ -96,7 +96,6 @@ const FATCH_OPTIONS: OptionsType = { headers: { [APP_REQUEST_HEADER_CODE]: import.meta.env.VITE_APP_CODE, [APP_REQUEST_HEADER_VERSION]: import.meta.env.VITE_APP_VERSION, - 'Accept-Language': `${localGet(CACHE_LOCAL_I18N)};q=0.9`, }, dataType: 'json', responseType: 'json', @@ -121,11 +120,19 @@ function beforeRequest(options: OptionsType): OptionsType | Promise { ); } + // 客户端接受语言 + Reflect.set( + options.headers, + 'Accept-Language', + `${localGet(CACHE_LOCAL_I18N) || 'en_US'};q=0.9` + ); + // 是否需要设置 token const token = getToken(); if (options.whithToken && token) { Reflect.set(options.headers, TOKEN_KEY, TOKEN_KEY_PREFIX + token); } + // 是否需要防止数据重复提交 if ( options.repeatSubmit &&