Feat: prelogin (#4773)

* add prelogin api (#4762)

* add prelogin api

* move type.d.ts

* perf: prelogin code

* doc

* fix: ts

---------

Co-authored-by: dreamer6680 <1468683855@qq.com>
This commit is contained in:
Archer
2025-05-08 22:09:02 +08:00
committed by GitHub
parent 83d54d046d
commit 12d6948ba7
10 changed files with 179 additions and 6 deletions

View File

@@ -2,7 +2,7 @@ import React, { type Dispatch } from 'react';
import { FormControl, Flex, Input, Button, Box, Link } from '@chakra-ui/react';
import { useForm } from 'react-hook-form';
import { LoginPageTypeEnum } from '@/web/support/user/login/constants';
import { postLogin } from '@/web/support/user/api';
import { postLogin, getPreLogin } from '@/web/support/user/api';
import type { ResLogin } from '@/global/support/api/userRes';
import { useToast } from '@fastgpt/web/hooks/useToast';
import { useSystemStore } from '@/web/common/system/useSystemStore';
@@ -33,10 +33,12 @@ const LoginForm = ({ setPageType, loginSuccess }: Props) => {
const { runAsync: onclickLogin, loading: requesting } = useRequest2(
async ({ username, password }: LoginFormType) => {
const { code } = await getPreLogin(username);
loginSuccess(
await postLogin({
username,
password
password,
code
})
);
toast({