Fix duplicate event modal page slug (#6657)

pull/6691/head
Joe Cohen 2023-01-25 03:16:50 -06:00 committed by GitHub
parent 425e18f53c
commit b1c0ea4c38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -192,7 +192,7 @@ export const EventTypeList = ({ group, groupIndex, readOnly, types }: EventTypeL
}
// inject selection data into url for correct router history
const openDuplicateModal = (eventType: EventType) => {
const openDuplicateModal = (eventType: EventType, group: EventTypeGroup) => {
const query = {
...router.query,
dialog: "duplicate-event-type",
@ -201,6 +201,7 @@ export const EventTypeList = ({ group, groupIndex, readOnly, types }: EventTypeL
slug: eventType.slug,
id: eventType.id,
length: eventType.length,
pageSlug: group.profile.slug,
};
router.push(
@ -370,7 +371,7 @@ export const EventTypeList = ({ group, groupIndex, readOnly, types }: EventTypeL
type="button"
data-testid={"event-type-duplicate-" + type.id}
StartIcon={FiCopy}
onClick={() => openDuplicateModal(type)}>
onClick={() => openDuplicateModal(type, group)}>
{t("duplicate")}
</DropdownItem>
</DropdownMenuItem>
@ -477,7 +478,7 @@ export const EventTypeList = ({ group, groupIndex, readOnly, types }: EventTypeL
className="w-full rounded-none"
data-testid={"event-type-duplicate-" + type.id}
StartIcon={FiCopy}
onClick={() => openDuplicateModal(type)}>
onClick={() => openDuplicateModal(type, group)}>
{t("duplicate")}
</Button>
</DropdownMenuItem>

View File

@ -55,7 +55,8 @@ const DuplicateDialog = () => {
},
});
const pageSlug = router.query.eventPage;
const { pageSlug } = router.query;
return (
<Dialog
name="duplicate-event-type"