Skip to content

Commit

Permalink
[KAIZEN-0] Hent fnr fra routeparams
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesperpaulsen committed Jan 16, 2024
1 parent a260593 commit 4612c3a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
5 changes: 4 additions & 1 deletion src/app/Routing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ function Routing() {
path={`${paths.saksdokumentEgetVindu}/:fodselsnummer/`}
render={(routeProps) => <SaksDokumentEgetVindu fnr={routeProps.match.params.fodselsnummer} />}
/>
<SentryRoute path={`${paths.personUri}/:fodselsnummer`} component={Personoversikt} />
<SentryRoute
path={`${paths.personUri}/:fodselsnummer`}
render={(routeProps) => <Personoversikt fnr={routeProps.match.params.fodselsnummer} />}
/>
<SentryRoute component={Startbilde} />
</Switch>
</Suspense>
Expand Down
12 changes: 2 additions & 10 deletions src/app/personside/Personoversikt.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import LyttPåNyttFnrIReduxOgHentAllPersoninfo from '../PersonOppslagHandler/LyttPåNyttFnrIReduxOgHentAllPersoninfo';
import MainLayout from './MainLayout';
import { useFodselsnummer, useOnMount } from '../../utils/customHooks';
import { useOnMount } from '../../utils/customHooks';
import { erGyldigishFnr } from '../../utils/fnr-utils';
import { useHistory } from 'react-router';
import { paths } from '../routes/routing';
Expand All @@ -10,13 +10,9 @@ import BegrensetTilgangSide from './BegrensetTilgangSide';
import tilgangskontroll from '../../rest/resources/tilgangskontrollResource';
import { DialogpanelStateProvider } from '../../context/dialogpanel-state';
import NyIdentModal from './NyIdentModal';
import useFeatureToggle from '../../components/featureToggle/useFeatureToggle';
import { FeatureToggles } from '../../components/featureToggle/toggleIDs';

function Personoversikt() {
const fnr = useFodselsnummer();
function Personoversikt({ fnr }: { fnr: string }) {
const history = useHistory();
const { isOn } = useFeatureToggle(FeatureToggles.IkkeFnrIPath);

useOnMount(() => {
if (!erGyldigishFnr(fnr)) {
Expand All @@ -25,10 +21,6 @@ function Personoversikt() {
}
});

if (!fnr?.length && isOn) {
return null;
}

return tilgangskontroll.useRenderer(fnr, (data) => {
if (!data.harTilgang) {
return <BegrensetTilgangSide tilgangsData={data} />;
Expand Down

0 comments on commit 4612c3a

Please sign in to comment.