mirror of
https://github.com/hexastack/hexabot
synced 2025-02-23 04:48:51 +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: {},
|
payload: {},
|
||||||
};
|
};
|
||||||
|
const typeValue = watch("type");
|
||||||
|
const titleValue = watch("title");
|
||||||
const onSubmitForm = (params: IMenuItemAttributes) => {
|
const onSubmitForm = (params: IMenuItemAttributes) => {
|
||||||
|
const { url, ...rest } = params;
|
||||||
|
const payload = typeValue === "web_url" ? { ...rest, url } : rest;
|
||||||
|
|
||||||
if (data?.row?.id) {
|
if (data?.row?.id) {
|
||||||
updateMenu({
|
updateMenu({
|
||||||
id: data.row.id,
|
id: data.row.id,
|
||||||
params,
|
params: payload,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
createMenu({ ...params, parent: data?.parentId });
|
createMenu({ ...payload, parent: data?.parentId });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -92,9 +97,6 @@ export const MenuForm: FC<ComponentFormProps<MenuFormData>> = ({
|
|||||||
}
|
}
|
||||||
}, [reset, data?.row]);
|
}, [reset, data?.row]);
|
||||||
|
|
||||||
const typeValue = watch("type");
|
|
||||||
const titleValue = watch("title");
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Wrapper
|
<Wrapper
|
||||||
open={!!WrapperProps?.open}
|
open={!!WrapperProps?.open}
|
||||||
|
Loading…
Reference in New Issue
Block a user