mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
feat: submit new password to backend and submit user information and add Form to UserSettingProfile (#114)
* feat: add Form to UserSettingProfile * feat: submit user information * feat: submit new password to backend
This commit is contained in:
23
web/src/pages/user-setting/hooks.ts
Normal file
23
web/src/pages/user-setting/hooks.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import { useOneNamespaceEffectsLoading } from '@/hooks/storeHooks';
|
||||
import { Form } from 'antd';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
export const useValidateSubmittable = () => {
|
||||
const [form] = Form.useForm();
|
||||
const [submittable, setSubmittable] = useState<boolean>(false);
|
||||
|
||||
// Watch all values
|
||||
const values = Form.useWatch([], form);
|
||||
|
||||
useEffect(() => {
|
||||
form
|
||||
.validateFields({ validateOnly: true })
|
||||
.then(() => setSubmittable(true))
|
||||
.catch(() => setSubmittable(false));
|
||||
}, [form, values]);
|
||||
|
||||
return { submittable, form };
|
||||
};
|
||||
|
||||
export const useGetUserInfoLoading = () =>
|
||||
useOneNamespaceEffectsLoading('settingModel', ['setting']);
|
||||
Reference in New Issue
Block a user