File tree 2 files changed +8
-2
lines changed
app/(fhir)/fhir/resources/sykmelding/write-to-ehr
2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,12 @@ export async function POST(request: Request): Promise<Response | DocRefResponseR
21
21
return new Response ( 'Missing sykmeldingId header' , { status : 400 } )
22
22
}
23
23
24
- const sykmeldingPdf = await sykInnApiService . getSykmeldingPdf ( sykmeldingId )
24
+ const hpr = request . headers . get ( 'HPR' )
25
+ if ( hpr == null ) {
26
+ return new Response ( 'Missing HPR header' , { status : 400 } )
27
+ }
28
+
29
+ const sykmeldingPdf = await sykInnApiService . getSykmeldingPdf ( sykmeldingId , hpr )
25
30
if ( 'errorType' in sykmeldingPdf ) {
26
31
return new Response ( 'Failed to retrieve sykmelding pdf' , { status : 500 } )
27
32
}
Original file line number Diff line number Diff line change @@ -65,14 +65,15 @@ export const sykInnApiService = {
65
65
} ,
66
66
responseSchema : ExistingSykmeldingSchema . array ( ) ,
67
67
} ) ,
68
- getSykmeldingPdf : async ( sykmeldingId : string ) : Promise < SykmeldingPdf | ApiFetchErrors > =>
68
+ getSykmeldingPdf : async ( sykmeldingId : string , hpr : string ) : Promise < SykmeldingPdf | ApiFetchErrors > =>
69
69
fetchInternalAPI ( {
70
70
api : 'syk-inn-api' ,
71
71
path : `/api/v1/sykmelding/${ sykmeldingId } /pdf` ,
72
72
method : 'GET' ,
73
73
headers : {
74
74
'Content-Type' : 'application/json' ,
75
75
sykmeldingId : sykmeldingId ,
76
+ HPR : hpr ,
76
77
} ,
77
78
responseSchema : SykmeldingPdfSchema ,
78
79
} ) ,
You can’t perform that action at this time.
0 commit comments