Fix NaN values when creating event type
parent
a9f9822091
commit
5aaf702e2b
|
@ -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>
|
||||||
) : (
|
) : (
|
||||||
|
|
Loading…
Reference in New Issue