fix filters form
This commit is contained in:
@@ -14,6 +14,12 @@ type FormValues = {
|
|||||||
url: string;
|
url: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const defaultValues: FormValues = {
|
||||||
|
enabled: true,
|
||||||
|
name: '',
|
||||||
|
url: '',
|
||||||
|
};
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
closeModal: () => void;
|
closeModal: () => void;
|
||||||
onSubmit: (values: FormValues) => void;
|
onSubmit: (values: FormValues) => void;
|
||||||
@@ -39,7 +45,13 @@ export const Form = ({
|
|||||||
}: Props) => {
|
}: Props) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const methods = useForm({ defaultValues: initialValues });
|
const methods = useForm({
|
||||||
|
defaultValues: {
|
||||||
|
...defaultValues,
|
||||||
|
...initialValues,
|
||||||
|
},
|
||||||
|
mode: 'onBlur',
|
||||||
|
});
|
||||||
const { handleSubmit, control } = methods;
|
const { handleSubmit, control } = methods;
|
||||||
|
|
||||||
const openModal = (modalType: keyof typeof MODAL_TYPE, timeout = MODAL_OPEN_TIMEOUT) => {
|
const openModal = (modalType: keyof typeof MODAL_TYPE, timeout = MODAL_OPEN_TIMEOUT) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user