Fix NaN values when creating event type

pull/1627/head^2
Miguel Nieto A 2022-01-26 15:56:08 -05:00 committed by Omar López
parent a9f9822091
commit 5aaf702e2b
1 changed files with 4 additions and 8 deletions

View File

@ -51,7 +51,9 @@ export default function CreateEventTypeButton(props: Props) {
// URL encoded params // URL encoded params
const teamId: number | undefined = 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 pageSlug = router.query.eventPage || props.options[0].slug;
const hasTeams = !!props.options.find((option) => option.teamId); const hasTeams = !!props.options.find((option) => option.teamId);
@ -123,13 +125,7 @@ export default function CreateEventTypeButton(props: Props) {
onClick={() => openModal(props.options[0])} onClick={() => openModal(props.options[0])}
data-testid="new-event-type" data-testid="new-event-type"
StartIcon={PlusIcon} StartIcon={PlusIcon}
{...(props.canAddEvents {...(props.canAddEvents ? { href: modalOpen.hrefOn } : { disabled: true })}>
? {
href: modalOpen.hrefOn,
}
: {
disabled: true,
})}>
{t("new_event_type_btn")} {t("new_event_type_btn")}
</Button> </Button>
) : ( ) : (