fix(web/input): properly reset from when using closeInputDialog

This commit is contained in:
Luke
2023-09-28 11:48:51 +02:00
parent 40fa45aab4
commit 9a40e6b519

View File

@@ -66,15 +66,14 @@ const InputDialog: React.FC = () => {
});
});
useNuiEvent('closeInputDialog', () => {
setVisible(false);
});
useNuiEvent('closeInputDialog', async () => await handleClose(true));
const handleClose = async () => {
const handleClose = async (dontPost?: boolean) => {
setVisible(false);
await new Promise((resolve) => setTimeout(resolve, 200));
form.reset();
fieldForm.remove();
if (dontPost) return;
fetchNui('inputData');
};