Skip to content

Commit

Permalink
[KAIZEN-0] tom frn bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
abrhanav committed Jan 12, 2024
1 parent 9e1e0c6 commit 12060ae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/app/personside/Personoversikt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function Personoversikt() {
}
});

return tilgangskontroll.useRenderer((data) => {
return tilgangskontroll.useRenderer(fnr, (data) => {
if (!data.harTilgang) {
return <BegrensetTilgangSide tilgangsData={data} />;
}
Expand Down
8 changes: 3 additions & 5 deletions src/rest/resources/tilgangskontrollResource.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import AlertStripe from 'nav-frontend-alertstriper';
import { apiBaseUri } from '../../api/config';
import { BigCenteredLazySpinner } from '../../components/BigCenteredLazySpinner';
import FillCenterAndFadeIn from '../../components/FillCenterAndFadeIn';
import { useGjeldendeBruker } from '../../redux/gjeldendeBruker/types';
import { useQuery, UseQueryResult } from '@tanstack/react-query';
import { FetchError, get, post } from '../../api/api';
import { useValgtenhet } from '../../context/valgtenhet-state';
Expand Down Expand Up @@ -57,14 +56,13 @@ function urlV2(enhet: string | undefined) {
}

const resource = {
useFetch(): UseQueryResult<TilgangDTO, FetchError> {
const fnr = useGjeldendeBruker();
useFetch(fnr: string): UseQueryResult<TilgangDTO, FetchError> {
const enhet = useValgtenhet().enhetId;
const { isOn } = useFeatureToggle(FeatureToggles.IkkeFnrIPath);
return useQuery(queryKey(fnr), () => (isOn ? post(urlV2(enhet), { fnr }) : get(url(fnr, enhet))));
},
useRenderer(renderer: RendererOrConfig<TilgangDTO>) {
const response = this.useFetch();
useRenderer(fnr: string, renderer: RendererOrConfig<TilgangDTO>) {
const response = this.useFetch(fnr);
return useRest(response, applyDefaults(defaults, renderer));
}
};
Expand Down

0 comments on commit 12060ae

Please sign in to comment.