From acba8a95982e6120bf3aadc27099e376000fa151 Mon Sep 17 00:00:00 2001 From: Tor Idland Date: Tue, 21 May 2024 13:35:15 +0200 Subject: [PATCH] =?UTF-8?q?:safety=5Fvest:=20gj=C3=B8r=20kontaktinformasjo?= =?UTF-8?q?n=20nullish(null=20eller=20undifined)=20p=C3=A5=20fastlege?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/api/oppslag/fastlege.ts | 6 +++--- utils/StringFormatters.ts | 2 +- utils/api.ts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pages/api/oppslag/fastlege.ts b/pages/api/oppslag/fastlege.ts index 755237bb..69cbbaa4 100644 --- a/pages/api/oppslag/fastlege.ts +++ b/pages/api/oppslag/fastlege.ts @@ -11,9 +11,9 @@ const Fastlege = z.object({ navn: z.string(), behandlerRef: z.string(), kontaktinformasjon: z.object({ - kontor: z.string().optional(), - adresse: z.string().optional(), - telefon: z.string().optional(), + kontor: z.string().nullish(), + adresse: z.string().nullish(), + telefon: z.string().nullish(), }), }); diff --git a/utils/StringFormatters.ts b/utils/StringFormatters.ts index 83c2c1ba..2173ba77 100644 --- a/utils/StringFormatters.ts +++ b/utils/StringFormatters.ts @@ -15,7 +15,7 @@ export const formatFullAdresse = (adresse?: Adresse) => adresse?.postnummer?.postnr || adresse?.postnummer?.poststed ? ',' : '' } ${adresse?.postnummer?.postnr ?? ''} ${adresse?.postnummer?.poststed ?? ''}`; -export const formatTelefonnummer = (telefonnummer?: string) => { +export const formatTelefonnummer = (telefonnummer?: string | null) => { if (!telefonnummer) { return ''; } diff --git a/utils/api.ts b/utils/api.ts index 82c57d14..1905aa60 100644 --- a/utils/api.ts +++ b/utils/api.ts @@ -41,14 +41,14 @@ enum Types { type Felt = { type: Types.FELT; felt?: string; - verdi?: string; + verdi?: string | null; }; type Fritekst = { type: Types.FRITEKST; tekst?: string; indent?: boolean; }; -const createField = (felt: string, verdi: string | undefined, skipIfFalsy = false) => { +const createField = (felt: string, verdi: string | undefined | null, skipIfFalsy = false) => { if (skipIfFalsy && !verdi) return []; const res: Felt = { type: Types.FELT,