From 896a58a5ebe07a12772d7bce8ab99e6588607cec Mon Sep 17 00:00:00 2001 From: baiqi Date: Fri, 25 Aug 2023 15:55:17 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE):=20?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E6=B1=A0=E5=91=BD=E5=90=8D=E8=B0=83=E6=95=B4?= =?UTF-8?q?&=E7=A9=BF=E6=A2=AD=E6=A1=86=E7=BB=84=E4=BB=B6=E8=B0=83?= =?UTF-8?q?=E6=95=B4&=E8=AF=B7=E6=B1=82=E6=90=BA=E5=B8=A6=E6=9C=AC?= =?UTF-8?q?=E5=9C=B0=E8=AF=AD=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/api/http/index.ts | 10 ++++++++- .../src/components/pure/ms-transfer/index.vue | 10 ++++----- frontend/src/locale/useLocale.ts | 1 + frontend/src/models/setting/resourcePool.ts | 2 +- .../setting/system/resourcePool/detail.vue | 22 +++++++++---------- .../setting/system/resourcePool/index.vue | 6 ++--- .../system/resourcePool/locale/en-US.ts | 2 +- .../system/resourcePool/locale/zh-CN.ts | 2 +- 8 files changed, 31 insertions(+), 24 deletions(-) diff --git a/frontend/src/api/http/index.ts b/frontend/src/api/http/index.ts index 274d7b14a8..904a2c0282 100644 --- a/frontend/src/api/http/index.ts +++ b/frontend/src/api/http/index.ts @@ -6,6 +6,7 @@ import { isString } from '@/utils/is'; import { getToken } from '@/utils/auth'; import { setObjToUrlParams, deepMerge } from '@/utils'; import { useI18n } from '@/hooks/useI18n'; +import useLocale from '@/locale/useLocale'; import { joinTimestamp } from './helper'; import type { AxiosResponse } from 'axios'; @@ -110,10 +111,17 @@ const transform: AxiosTransform = { */ requestInterceptors: (config) => { // 请求之前处理config + const { currentLocale } = useLocale(); const token = getToken(); if (token && (config as Recordable)?.requestOptions?.withToken !== false) { const { sessionId, csrfToken } = token; - (config as Recordable).headers = { 'X-AUTH-TOKEN': sessionId, 'CSRF-TOKEN': csrfToken }; + + (config as Recordable).headers = { + ...config.headers, + 'X-AUTH-TOKEN': sessionId, + 'CSRF-TOKEN': csrfToken, + 'Accept-Language': currentLocale.value, + }; } return config; }, diff --git a/frontend/src/components/pure/ms-transfer/index.vue b/frontend/src/components/pure/ms-transfer/index.vue index 27f4659267..f6df64adff 100644 --- a/frontend/src/components/pure/ms-transfer/index.vue +++ b/frontend/src/components/pure/ms-transfer/index.vue @@ -5,12 +5,12 @@ :data="transferData" show-search > -