This is an automated email from the ASF dual-hosted git repository. kriszu pushed a commit to branch qrcode in repository https://gitbox.apache.org/repos/asf/incubator-streampark.git
commit 3d395431b488b76da941a3f7d275f5dc92640d4b Author: kriszu <[email protected]> AuthorDate: Sun Feb 18 10:17:56 2024 +0800 feat: add language header to requests --- .../streampark-console-webapp/src/utils/http/axios/index.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/streampark-console/streampark-console-webapp/src/utils/http/axios/index.ts b/streampark-console/streampark-console-webapp/src/utils/http/axios/index.ts index adc025cbe..7123a7ada 100644 --- a/streampark-console/streampark-console-webapp/src/utils/http/axios/index.ts +++ b/streampark-console/streampark-console-webapp/src/utils/http/axios/index.ts @@ -15,6 +15,7 @@ import { useErrorLogStoreWithOut } from '/@/store/modules/errorLog'; import { useI18n } from '/@/hooks/web/useI18n'; import { joinTimestamp, formatRequestDate } from './helper'; import { useUserStoreWithOut } from '/@/store/modules/user'; +import { useLocaleStoreWithOut } from '/@/store/modules/locale'; import { AxiosRetry } from '/@/utils/http/axios/axiosRetry'; import { errorHandler } from './errorHandle'; @@ -93,6 +94,8 @@ const transform: AxiosTransform = { const data = config.data || false; formatDate && data && !isString(data) && formatRequestDate(data); const teamId = getUserTeamId(); + const localStore = useLocaleStoreWithOut(); + config.headers = Object.assign(config.headers || {}, { 'language': localStore.getLocale }); if (config.method?.toUpperCase() === RequestEnum.GET) { if (!isString(params)) { // Add a timestamp parameter to the get request to avoid taking data from the cache.
