Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #291 from navikt/dev
Browse files Browse the repository at this point in the history
Fiks henting av veileder
  • Loading branch information
matiasvinjevoll authored Jun 2, 2022
2 parents 6e4b805 + da57003 commit 8f7c5aa
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect } from 'react';
import React, { useEffect, useState } from 'react';
import InformasjonsbolkEnkel from '../../../felles/informasjonsbolk-enkel';
import EMDASH from '../../../../utils/emdash';
import Grid from '../../../felles/grid';
Expand Down Expand Up @@ -43,15 +43,16 @@ const OppfolgingPanelInnhold = () => {
const personalia = usePromise<AxiosResponse<PersonaliaV2Info>>(() => fetchPersonaliaV2(fnr));
const innsatsbehov = usePromise<AxiosResponse<Innsatsbehov>>(() => fetchInnsatsbehov(fnr));
const veilederId = isResolved(oppfolgingsstatus) ? oppfolgingsstatus.result.data.veilederId : null;
const veileder = usePromise<AxiosResponse<VeilederData>>(() => fetchVeileder(fnr));
const [veileder, setVeileder] = useState<AxiosResponse<VeilederData> | null>(null);
const tilhorerBrukerUtrulletKontorForVedtaksstotte = usePromise<AxiosResponse<VeilederData>>(() =>
fetchTilgorerBrukerUtrulletKontorForVedtaksstotte(fnr)
);

useEffect(() => {
if (!isResolved(veileder) && veilederId != null) {
// veileder.rerun();
console.log('veileder.rerun()');
if (!veileder && veilederId != null) {
fetchVeileder(veilederId).then(data => {
setVeileder(data);
});
}
// TODO: Når use-fetch memoiseres riktig, så legg til alle dependencies
// eslint-disable-next-line
Expand All @@ -61,7 +62,7 @@ const OppfolgingPanelInnhold = () => {
return <Laster midtstilt={true} />;
}

const veilederData = isResolved(veileder) ? veileder.result.data : null;
const veilederData = veileder ? veileder.data : null;
const personaliaData = isResolved(personalia) ? personalia.result.data : null;
const innsatsbehovData = isResolved(innsatsbehov) ? innsatsbehov.result.data : null;
const oppfolgingsstatusData = isResolved(oppfolgingsstatus) ? oppfolgingsstatus.result.data : null;
Expand Down

0 comments on commit 8f7c5aa

Please sign in to comment.