diff --git a/package-lock.json b/package-lock.json index 871e98bd4..cfdae0758 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22113,9 +22113,9 @@ } }, "node_modules/word-wrap": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.4.tgz", + "integrity": "sha512-2V81OA4ugVo5pRo46hAoD2ivUJx8jXmWXfUkY4KFNw0hEptvN0QfH3K4nHiwzGeKl5rFKedV48QVoqYavy4YpA==", "dev": true, "engines": { "node": ">=0.10.0" @@ -40439,9 +40439,9 @@ } }, "word-wrap": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.4.tgz", + "integrity": "sha512-2V81OA4ugVo5pRo46hAoD2ivUJx8jXmWXfUkY4KFNw0hEptvN0QfH3K4nHiwzGeKl5rFKedV48QVoqYavy4YpA==", "dev": true }, "workbox-background-sync": { diff --git a/src/app/personside/infotabs/saksoversikt/dokumentvisning/SaksDokumentVisning.tsx b/src/app/personside/infotabs/saksoversikt/dokumentvisning/SaksDokumentVisning.tsx index dfbdb7975..136c1f7f7 100644 --- a/src/app/personside/infotabs/saksoversikt/dokumentvisning/SaksDokumentVisning.tsx +++ b/src/app/personside/infotabs/saksoversikt/dokumentvisning/SaksDokumentVisning.tsx @@ -44,7 +44,7 @@ function DokumentVisning(props: Props) { const url = getMockableUrl(byggDokumentVisningUrl(props.url, props.fnr)); return ( - + {errMsg} diff --git a/src/components/ObjectHttpFeilHandtering.tsx b/src/components/ObjectHttpFeilHandtering.tsx index bebd1822f..aedf47cbf 100644 --- a/src/components/ObjectHttpFeilHandtering.tsx +++ b/src/components/ObjectHttpFeilHandtering.tsx @@ -12,22 +12,25 @@ interface Props export function ObjectHttpFeilHandtering({ url, onError, children, ...rest }: Props) { const [blobUrl, setBlobUrl] = useState(''); + const [contentType, setContentType] = useState(''); const [isError, setError] = useState(false); useEffect(() => { let objectUrl = ''; fetch(url) - .then(res => { + .then((res) => { if (!res.ok) { setError(true); onError(res.status); } else { + setContentType(res.headers.get('Content-Type') ?? 'application/pdf'); setError(false); } return res.blob(); }) - .then(blob => { + .then((blob) => { objectUrl = URL.createObjectURL(blob); + setBlobUrl(objectUrl); }); @@ -42,5 +45,5 @@ export function ObjectHttpFeilHandtering({ url, onError, children, ...rest }: Pr return <>{children}; } - return ; + return ; }