From 014b74be8c276657718b7a08751bf5f49352431f Mon Sep 17 00:00:00 2001 From: Alex van Andel Date: Sat, 9 Oct 2021 15:48:26 +0100 Subject: [PATCH] Fixes custom-inputs clearing on save (#890) --- pages/api/availability/eventtype.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/api/availability/eventtype.ts b/pages/api/availability/eventtype.ts index afa8588f..188b04b6 100644 --- a/pages/api/availability/eventtype.ts +++ b/pages/api/availability/eventtype.ts @@ -5,7 +5,7 @@ import { getSession } from "@lib/auth"; import prisma from "@lib/prisma"; function handleCustomInputs(customInputs: EventTypeCustomInput[], eventTypeId: number) { - if (!customInputs || customInputs?.length) return undefined; + if (!customInputs || !customInputs?.length) return undefined; const cInputsIdsToDelete = customInputs.filter((input) => input.id > 0).map((e) => e.id); const cInputsToCreate = customInputs .filter((input) => input.id < 0)