-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
⚗️ mellomlagrer til nytt endepunkt med vedlegg array
Co-authored-by: Øivind Stensrud <[email protected]> Co-authored-by: Thomas Rognes <[email protected]>
- Loading branch information
1 parent
309d06c
commit 2d1e186
Showing
7 changed files
with
66 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { Soknad } from 'types/Soknad'; | ||
import { AttachmentType } from 'types/SoknadContext'; | ||
|
||
export interface Fil { | ||
id: string; | ||
tittel: string; | ||
} | ||
export const søknadVedleggStateTilFilArray = (søknad: Soknad) => { | ||
const filer: Fil[] = Object.keys(søknad.vedlegg ?? {}) | ||
.map((key) => { | ||
const vedleggArray = søknad?.vedlegg?.[key]; | ||
const filerArray: Fil[] = | ||
vedleggArray?.map((vedlegg) => { | ||
return { | ||
id: vedlegg.vedleggId, | ||
tittel: mapVedleggTypeTilVedleggTekst(key), | ||
}; | ||
}) ?? []; | ||
|
||
return filerArray; | ||
}) | ||
.flat(); | ||
return filer; | ||
}; | ||
function mapVedleggTypeTilVedleggTekst(vedleggType: AttachmentType): string { | ||
switch (vedleggType) { | ||
case 'LØNN_OG_ANDRE_GODER': | ||
return 'Dokumentasjon om lønn og andre goder'; | ||
case 'OMSORGSSTØNAD': | ||
return 'Dokumentasjon om omsorgsstønad'; | ||
case 'UTLANDSSTØNAD': | ||
return 'Dokumentasjon om utenlandsstønad'; | ||
case 'SYKESTIPEND': | ||
return 'Dokumentasjon om sykestipend'; | ||
case 'LÅN': | ||
return 'Dokumentasjon om lån'; | ||
case 'AVBRUTT_STUDIE': | ||
return 'Dokumentasjon om avbrutt studie'; | ||
case 'ANNET': | ||
return 'Annen dokumentasjon'; | ||
default: | ||
return 'Dokumentasjon om barn eller fosterbarn'; | ||
} | ||
} |