Skip to content

Commit

Permalink
Kun en request om gangen tillat av visbrevinyfane
Browse files Browse the repository at this point in the history
  • Loading branch information
EndreHM committed Dec 17, 2024
1 parent a9d8a70 commit cdae510
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions src/frontend/Komponenter/Behandling/Modal/HenleggModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,26 @@ export const HenleggModal: FC<{
const [harHuketAvSendBrev, settHarHuketAvSendBrev] = useState<boolean>(true);
const [låsKnapp, settLåsKnapp] = useState<boolean>(false);
const [feilmelding, settFeilmelding] = useState<string>();
const [henterBrev, settHenterBrev] = useState<boolean>(false);

const visBrevINyFane = () => {
axiosRequest<string, null>({
method: 'GET',
url: `familie-ef-sak/api/behandling/${behandling.id}/henlegg/brev/forhandsvisning`,
}).then((respons: RessursSuksess<string> | RessursFeilet) => {
if (respons.status === RessursStatus.SUKSESS) {
åpnePdfIEgenTab(
base64toBlob(respons.data, 'application/pdf'),
'Forhåndsvisning av varselbrev'
);
} else {
settFeilmelding(respons.frontendFeilmelding);
}
});
if (!henterBrev) {
settHenterBrev(true);
axiosRequest<string, null>({
method: 'GET',
url: `familie-ef-sak/api/behandling/${behandling.id}/henlegg/brev/forhandsvisning`,
}).then((respons: RessursSuksess<string> | RessursFeilet) => {
if (respons.status === RessursStatus.SUKSESS) {
åpnePdfIEgenTab(
base64toBlob(respons.data, 'application/pdf'),
'Forhåndsvisning av trukket søknadsbrev'
);
} else {
settFeilmelding(respons.frontendFeilmelding);
}
settHenterBrev(false);
});
}
};

const utledEndepunktForHenleggelse = (rolle: AnsvarligSaksbehandlerRolle) =>
Expand Down

0 comments on commit cdae510

Please sign in to comment.