mirror of
https://github.com/labring/FastGPT.git
synced 2025-08-02 20:58:12 +00:00
V4.6.6-1 (#656)
This commit is contained in:
@@ -17,7 +17,7 @@ export const sendAuthCode = (data: {
|
||||
}) => POST(`/plusApi/support/user/inform/sendAuthCode`, data);
|
||||
|
||||
export const getTokenLogin = () =>
|
||||
GET<UserType>('/user/account/tokenLogin', {}, { maxQuantity: 1 });
|
||||
GET<UserType>('/support/user/account/tokenLogin', {}, { maxQuantity: 1 });
|
||||
export const oauthLogin = (params: OauthLoginProps) =>
|
||||
POST<ResLogin>('/plusApi/support/user/account/login/oauth', params);
|
||||
export const postFastLogin = (params: FastLoginProps) =>
|
||||
@@ -57,17 +57,17 @@ export const postFindPassword = ({
|
||||
});
|
||||
|
||||
export const updatePasswordByOld = ({ oldPsw, newPsw }: { oldPsw: string; newPsw: string }) =>
|
||||
POST('/user/account/updatePasswordByOld', {
|
||||
POST('/support/user/account/updatePasswordByOld', {
|
||||
oldPsw: hashStr(oldPsw),
|
||||
newPsw: hashStr(newPsw)
|
||||
});
|
||||
|
||||
export const postLogin = ({ password, ...props }: PostLoginProps) =>
|
||||
POST<ResLogin>('/user/account/loginByPassword', {
|
||||
POST<ResLogin>('/support/user/account/loginByPassword', {
|
||||
...props,
|
||||
password: hashStr(password)
|
||||
});
|
||||
|
||||
export const loginOut = () => GET('/user/account/loginout');
|
||||
export const loginOut = () => GET('/support/user/account/loginout');
|
||||
|
||||
export const putUserInfo = (data: UserUpdateParams) => PUT('/user/account/update', data);
|
||||
export const putUserInfo = (data: UserUpdateParams) => PUT('/support/user/account/update', data);
|
||||
|
@@ -4,14 +4,17 @@ import { UserAuthTypeEnum } from '@fastgpt/global/support/user/constant';
|
||||
import { useToast } from '@/web/common/hooks/useToast';
|
||||
import { feConfigs } from '@/web/common/system/staticData';
|
||||
import { getErrText } from '@fastgpt/global/common/error/utils';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
|
||||
let timer: any;
|
||||
|
||||
export const useSendCode = () => {
|
||||
const { t } = useTranslation();
|
||||
const { toast } = useToast();
|
||||
const [codeSending, setCodeSending] = useState(false);
|
||||
const [codeCountDown, setCodeCountDown] = useState(0);
|
||||
const sendCodeText = useMemo(() => {
|
||||
if (codeSending) return t('support.user.auth.Sending Code');
|
||||
if (codeCountDown >= 10) {
|
||||
return `${codeCountDown}s后重新获取`;
|
||||
}
|
||||
@@ -19,10 +22,11 @@ export const useSendCode = () => {
|
||||
return `0${codeCountDown}s后重新获取`;
|
||||
}
|
||||
return '获取验证码';
|
||||
}, [codeCountDown]);
|
||||
}, [codeCountDown, codeSending, t]);
|
||||
|
||||
const sendCode = useCallback(
|
||||
async ({ username, type }: { username: string; type: `${UserAuthTypeEnum}` }) => {
|
||||
if (codeCountDown > 0) return;
|
||||
setCodeSending(true);
|
||||
try {
|
||||
await sendAuthCode({
|
||||
@@ -52,7 +56,7 @@ export const useSendCode = () => {
|
||||
}
|
||||
setCodeSending(false);
|
||||
},
|
||||
[toast]
|
||||
[codeCountDown, toast]
|
||||
);
|
||||
|
||||
return {
|
||||
|
Reference in New Issue
Block a user