Skip to content

Commit

Permalink
Flytt kall mot vurderinger lenger inn slik at vi kan sjekke stillingsid
Browse files Browse the repository at this point in the history
  • Loading branch information
joarau committed Aug 1, 2023
1 parent 6f0cf59 commit ab4c015
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 27 deletions.
2 changes: 1 addition & 1 deletion mock/presenterte-kandidater-api/mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { api } from '../../src/felles/api';

export const presenterteKandidaterApiMock = [
rest.get(
`${api.presenterteKandidaterApi}/kandidatliste/3d2e6a60-9cd5-551a-b8cf-8fce1954c5da/vurdering`,
`${api.presenterteKandidaterApi}/kandidatliste/1ea746af-66be-4cf8-a051-9e815f77b1d1/vurdering`,
(_, res, ctx) => res(ctx.json(mockArbeidsgiversVurderinger))
),
];
Expand Down
27 changes: 27 additions & 0 deletions src/kandidat/kandidatliste/Kandidatliste.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import FeilVedSendingAvForespørsel from './feil-ved-sending-av-forespørsel/Fei
import { Search } from '@navikt/ds-react';
import css from './Kandidatliste.module.css';
import { Kandidatstatus } from 'felles/domene/kandidatliste/KandidatIKandidatliste';
import { api } from 'felles/api';

type Props = {
kandidatliste: Kandidatlistetype;
Expand All @@ -65,6 +66,32 @@ const Kandidatliste: FunctionComponent<Props> = ({
onToggleMarkert,
onToggleArkivert,
}) => {
useEffect(() => {
const hentArbeidsgiversVurderinger = async (stillingId: string) => {
try {
const respons = await fetch(
`${api.presenterteKandidaterApi}/kandidatliste/${stillingId}/vurdering`,
{
method: 'GET',
headers: { 'Content-Type': 'application/json' },
}
);
const vurderingerJson = await respons.json();
console.log(
'Arbeidsgivers vurderinger: ',
vurderingerJson,
JSON.stringify(vurderingerJson)
);
} catch (e) {
console.log('Kall mot arbeidsgivers vurderinger feilet: ' + e);
}
};
if (kandidatliste.stillingId !== null) {
console.log('stillingsId er ' + kandidatliste.stillingId);
hentArbeidsgiversVurderinger(kandidatliste.stillingId);
}
});

useMaskerFødselsnumre();
useHentSendteMeldinger(kandidatliste.kandidatlisteId);
useHentForespørslerOmDelingAvCv(kandidatliste.stillingId);
Expand Down
26 changes: 0 additions & 26 deletions src/kandidat/kandidatliste/Kandidatlisteside.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import KandidatlisteOgModaler from './KandidatlisteOgModaler';
import useScrollTilToppen from './hooks/useScrollTilToppen';
import KandidatlisteActionType from './reducer/KandidatlisteActionType';
import Sidelaster from '../komponenter/sidelaster/Sidelaster';
import { api } from 'felles/api';

type Props = {
stillingsId?: string;
Expand All @@ -34,31 +33,6 @@ const Kandidatlisteside: FunctionComponent<Props> = ({ stillingsId, kandidatlist
});
console.log('Uten stillingsid');
}

const hentArbeidsgiversVurderinger = async (stillingId: string) => {
try {
const respons = await fetch(
`${api.presenterteKandidaterApi}/kandidatliste/${stillingId}/vurdering`,
{
method: 'GET',
headers: { 'Content-Type': 'application/json' },
}
);
const vurderingerJson = await respons.json();
console.log(
'Arbeidsgivers vurderinger: ',
vurderingerJson,
JSON.stringify(vurderingerJson)
);
} catch (e) {
console.log('Kall mot arbeidsgivers vurderinger feilet: ' + e);
}
};
console.log('stillingsId er ' + stillingsId);
if (stillingsId) {
console.log('inne i if');
hentArbeidsgiversVurderinger(stillingsId);
}
}, [dispatch, stillingsId, kandidatlisteId]);

if (kandidatliste.kind === Nettstatus.LasterInn) {
Expand Down

0 comments on commit ab4c015

Please sign in to comment.