fix: reset estimates modal form after create/update (#893)

This commit is contained in:
Aaryan Khandelwal 2023-04-20 12:09:35 +05:30 committed by GitHub
parent ebce364104
commit d30a88832a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,6 +41,11 @@ export const CreateUpdateEstimateModal: React.FC<Props> = ({ handleClose, data,
defaultValues,
});
const onClose = () => {
handleClose();
reset();
};
const router = useRouter();
const { workspaceSlug, projectId } = router.query;
@ -62,7 +67,6 @@ export const CreateUpdateEstimateModal: React.FC<Props> = ({ handleClose, data,
(prevData) => [res, ...(prevData ?? [])],
false
);
handleClose();
})
.catch(() => {
setToastAlert({
@ -71,6 +75,8 @@ export const CreateUpdateEstimateModal: React.FC<Props> = ({ handleClose, data,
message: "Error: Estimate could not be created",
});
});
onClose();
};
const updateEstimate = async (formData: IEstimate) => {
@ -102,7 +108,8 @@ export const CreateUpdateEstimateModal: React.FC<Props> = ({ handleClose, data,
message: "Error: Estimate could not be updated",
});
});
handleClose();
onClose();
};
useEffect(() => {