@@ -1,5 +1,5 @@
|
||||
import { usePreparationDirty } from '@/hooks/use-preparation-dirty';
|
||||
import { Head, Link, router, useForm } from '@inertiajs/react';
|
||||
import { useEffect, useRef } from 'react';
|
||||
import {
|
||||
FormErrors,
|
||||
PageTitle,
|
||||
@@ -139,22 +139,7 @@ export default function ImportEstimate(props: Props) {
|
||||
})),
|
||||
},
|
||||
);
|
||||
const ref = useRef<HTMLFormElement>(null);
|
||||
useEffect(() => {
|
||||
const node = ref.current;
|
||||
window.dispatchEvent(
|
||||
new CustomEvent('sgc:context-dirty', {
|
||||
detail: { form: node, dirty: form.isDirty },
|
||||
}),
|
||||
);
|
||||
return () => {
|
||||
window.dispatchEvent(
|
||||
new CustomEvent('sgc:context-dirty', {
|
||||
detail: { form: node, dirty: false },
|
||||
}),
|
||||
);
|
||||
};
|
||||
}, [form.isDirty]);
|
||||
const ref = usePreparationDirty(form.isDirty);
|
||||
return (
|
||||
<>
|
||||
<Head title="Estimativa de importação" />
|
||||
|
||||
Reference in New Issue
Block a user