mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-14 08:58:27 +08:00
* feat: add loading to all pages * fix: disable sending messages if both application and conversation are empty * feat: add chatSpin class to Spin of chat
27 lines
798 B
TypeScript
27 lines
798 B
TypeScript
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 useSelectSubmitUserInfoLoading = () =>
|
|
useOneNamespaceEffectsLoading('settingModel', ['setting']);
|
|
|
|
export const useSelectUserInfoLoading = () =>
|
|
useOneNamespaceEffectsLoading('settingModel', ['getUserInfo']);
|