forked from github/plane
fix: reset estimates modal form after create/update (#893)
This commit is contained in:
parent
ebce364104
commit
d30a88832a
@ -41,6 +41,11 @@ export const CreateUpdateEstimateModal: React.FC<Props> = ({ handleClose, data,
|
|||||||
defaultValues,
|
defaultValues,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const onClose = () => {
|
||||||
|
handleClose();
|
||||||
|
reset();
|
||||||
|
};
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { workspaceSlug, projectId } = router.query;
|
const { workspaceSlug, projectId } = router.query;
|
||||||
|
|
||||||
@ -62,7 +67,6 @@ export const CreateUpdateEstimateModal: React.FC<Props> = ({ handleClose, data,
|
|||||||
(prevData) => [res, ...(prevData ?? [])],
|
(prevData) => [res, ...(prevData ?? [])],
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
handleClose();
|
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
@ -71,6 +75,8 @@ export const CreateUpdateEstimateModal: React.FC<Props> = ({ handleClose, data,
|
|||||||
message: "Error: Estimate could not be created",
|
message: "Error: Estimate could not be created",
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onClose();
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateEstimate = async (formData: IEstimate) => {
|
const updateEstimate = async (formData: IEstimate) => {
|
||||||
@ -102,7 +108,8 @@ export const CreateUpdateEstimateModal: React.FC<Props> = ({ handleClose, data,
|
|||||||
message: "Error: Estimate could not be updated",
|
message: "Error: Estimate could not be updated",
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
handleClose();
|
|
||||||
|
onClose();
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
Loading…
Reference in New Issue
Block a user