From 5aaf702e2b1e3767a086ff3bf61f3e265e284780 Mon Sep 17 00:00:00 2001 From: Miguel Nieto A Date: Wed, 26 Jan 2022 15:56:08 -0500 Subject: [PATCH] Fix NaN values when creating event type --- components/eventtype/CreateEventType.tsx | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/components/eventtype/CreateEventType.tsx b/components/eventtype/CreateEventType.tsx index 6480bb789e..dcb8b38cbb 100644 --- a/components/eventtype/CreateEventType.tsx +++ b/components/eventtype/CreateEventType.tsx @@ -51,7 +51,9 @@ export default function CreateEventTypeButton(props: Props) { // URL encoded params const teamId: number | undefined = - typeof router.query.teamId === "string" ? parseInt(router.query.teamId) : undefined; + typeof router.query.teamId === "string" && router.query.teamId + ? parseInt(router.query.teamId) + : undefined; const pageSlug = router.query.eventPage || props.options[0].slug; const hasTeams = !!props.options.find((option) => option.teamId); @@ -123,13 +125,7 @@ export default function CreateEventTypeButton(props: Props) { onClick={() => openModal(props.options[0])} data-testid="new-event-type" StartIcon={PlusIcon} - {...(props.canAddEvents - ? { - href: modalOpen.hrefOn, - } - : { - disabled: true, - })}> + {...(props.canAddEvents ? { href: modalOpen.hrefOn } : { disabled: true })}> {t("new_event_type_btn")} ) : (