mirror of
https://github.com/hexastack/hexabot
synced 2025-02-23 04:48:51 +00:00
fix: minor
This commit is contained in:
parent
044ce6e725
commit
fe13e43b66
@ -56,21 +56,6 @@ export const ContentTypeDialog: FC<ContentTypeDialogProps> = ({
|
||||
closeDialog();
|
||||
reset();
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (open) reset();
|
||||
}, [open, reset]);
|
||||
|
||||
useEffect(() => {
|
||||
if (data) {
|
||||
reset({
|
||||
name: data.name,
|
||||
});
|
||||
} else {
|
||||
reset();
|
||||
}
|
||||
}, [data, reset]);
|
||||
|
||||
const { mutate: createContentType } = useCreate(EntityType.CONTENT_TYPE, {
|
||||
onError: (error) => {
|
||||
toast.error(error);
|
||||
@ -96,10 +81,24 @@ export const ContentTypeDialog: FC<ContentTypeDialogProps> = ({
|
||||
if (data) {
|
||||
updateContentType({ id: data.id, params });
|
||||
} else {
|
||||
createContentType({ ...params, name: params.name || "" });
|
||||
createContentType(params);
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (open) reset();
|
||||
}, [open, reset]);
|
||||
|
||||
useEffect(() => {
|
||||
if (data) {
|
||||
reset({
|
||||
name: data.name,
|
||||
});
|
||||
} else {
|
||||
reset();
|
||||
}
|
||||
}, [data, reset]);
|
||||
|
||||
return (
|
||||
<Dialog open={open} fullWidth onClose={CloseAndReset}>
|
||||
<form onSubmit={handleSubmit(onSubmitForm)}>
|
||||
|
Loading…
Reference in New Issue
Block a user