Skip to content

Commit

Permalink
🦺 gjør kontaktinformasjon nullish(null eller undifined) på fastlege
Browse files Browse the repository at this point in the history
  • Loading branch information
tidnav committed May 21, 2024
1 parent 1d22856 commit acba8a9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions pages/api/oppslag/fastlege.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}),
});

Expand Down
2 changes: 1 addition & 1 deletion utils/StringFormatters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 '';
}
Expand Down
4 changes: 2 additions & 2 deletions utils/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit acba8a9

Please sign in to comment.