Skip to content

Commit 482507e

Browse files
committed
feat: send auth code i18n
1 parent 999fe70 commit 482507e

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

projects/app/src/web/support/user/api.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@ import type {
1616
} from '@fastgpt/global/support/user/login/api.d';
1717
import type { preLoginResponse } from '@/pages/api/support/user/account/preLogin';
1818
import type { WxLoginProps } from '@fastgpt/global/support/user/api.d';
19+
import type { LangEnum } from '@fastgpt/global/common/i18n/type';
1920

2021
export const sendAuthCode = (data: {
2122
username: string;
2223
type: `${UserAuthTypeEnum}`;
2324
googleToken: string;
2425
captcha: string;
26+
lang: `${LangEnum}`;
2527
}) => POST(`/proApi/support/user/inform/sendAuthCode`, data);
2628

2729
export const getTokenLogin = () =>

projects/app/src/web/support/user/hooks/useSendCode.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ import { Box, type BoxProps, useDisclosure } from '@chakra-ui/react';
88
import SendCodeAuthModal from '@/components/support/user/safe/SendCodeAuthModal';
99
import { useMemoizedFn } from 'ahooks';
1010
import { useToast } from '@fastgpt/web/hooks/useToast';
11+
import type { LangEnum } from '@fastgpt/global/common/i18n/type';
1112
let timer: NodeJS.Timeout;
1213

1314
export const useSendCode = ({ type }: { type: `${UserAuthTypeEnum}` }) => {
14-
const { t } = useTranslation();
15+
const { t, i18n } = useTranslation();
1516
const { feConfigs } = useSystemStore();
1617
const { toast } = useToast();
1718
const [codeCountDown, setCodeCountDown] = useState(0);
@@ -20,7 +21,7 @@ export const useSendCode = ({ type }: { type: `${UserAuthTypeEnum}` }) => {
2021
async ({ username, captcha }: { username: string; captcha: string }) => {
2122
if (codeCountDown > 0) return;
2223
const googleToken = await getClientToken(feConfigs.googleClientVerKey);
23-
await sendAuthCode({ username, type, googleToken, captcha });
24+
await sendAuthCode({ username, type, googleToken, captcha, lang: i18n.language as LangEnum });
2425

2526
setCodeCountDown(60);
2627

0 commit comments

Comments
 (0)