mirror of
https://github.com/hexastack/hexabot
synced 2025-02-22 20:38:32 +00:00
fix(frontend): remove extra menu payload fields
This commit is contained in:
parent
7510e3572a
commit
253d917fd7
@ -73,14 +73,19 @@ export const MenuForm: FC<ComponentFormProps<MenuFormData>> = ({
|
||||
},
|
||||
payload: {},
|
||||
};
|
||||
const typeValue = watch("type");
|
||||
const titleValue = watch("title");
|
||||
const onSubmitForm = (params: IMenuItemAttributes) => {
|
||||
const { url, ...rest } = params;
|
||||
const payload = typeValue === "web_url" ? { ...rest, url } : rest;
|
||||
|
||||
if (data?.row?.id) {
|
||||
updateMenu({
|
||||
id: data.row.id,
|
||||
params,
|
||||
params: payload,
|
||||
});
|
||||
} else {
|
||||
createMenu({ ...params, parent: data?.parentId });
|
||||
createMenu({ ...payload, parent: data?.parentId });
|
||||
}
|
||||
};
|
||||
|
||||
@ -92,9 +97,6 @@ export const MenuForm: FC<ComponentFormProps<MenuFormData>> = ({
|
||||
}
|
||||
}, [reset, data?.row]);
|
||||
|
||||
const typeValue = watch("type");
|
||||
const titleValue = watch("title");
|
||||
|
||||
return (
|
||||
<Wrapper
|
||||
open={!!WrapperProps?.open}
|
||||
|
Loading…
Reference in New Issue
Block a user