Skip to content

Commit

Permalink
debugger med
Browse files Browse the repository at this point in the history
  • Loading branch information
d142796 committed Jan 16, 2025
1 parent 64a4b7e commit 8c0abbb
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 19 deletions.
10 changes: 0 additions & 10 deletions src/InnloggingBoundary/InnloggingBoundary.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
import ByttTilBeslutter from '@/InnloggingBoundary/byttTilBeslutter/ByttTilBeslutter';
import ByttTilVeileder from '@/InnloggingBoundary/ByttTilVeileder';
import decoratorconfig from '@/internflateDekorator/decoratorconfig';
import { DecoratorProps } from '@/internflateDekorator/decoratorprops';
import { useAsyncError } from '@/komponenter/useError';
import VarselKomponent from '@/komponenter/Varsel/VarselKomponent';
import { INNLOGGET_PART } from '@/RedirectEtterLogin';
import { sjekkOmMenySkalBrukes } from '@/services/internt';
import { InnloggetBruker } from '@/types/innlogget-bruker';
import NAVSPA from '@navikt/navspa';
import React, { FunctionComponent, PropsWithChildren, useEffect, useState } from 'react';
import { useCookies } from 'react-cookie';
import { useNavigate } from 'react-router-dom';
import Innloggingslinje from './Innloggingslinje';
import Innloggingside from './Innloggingsside';
import useInnlogget from './useInnlogget';

const dekoratorConfig = decoratorconfig();
const InternflateDecorator = NAVSPA.importer<DecoratorProps>('internarbeidsflate-decorator-v3');

export const InnloggetBrukerContext = React.createContext<InnloggetBruker>({
identifikator: '',
erNavAnsatt: false,
Expand Down Expand Up @@ -63,10 +57,6 @@ const InnloggingBoundary: FunctionComponent<PropsWithChildren> = (props) => {
if (brukBackupmeny === undefined || brukmeny === undefined) return null;
return (
<>
{brukmeny && <InternflateDecorator {...dekoratorConfig} />}
<Innloggingslinje brukBackupmeny={brukBackupmeny} innloggetBruker={innloggetBruker} />
{innloggetBruker.rolle === 'VEILEDER' && innloggetBruker.kanVæreBeslutter && <ByttTilBeslutter />}
{innloggetBruker.rolle === 'BESLUTTER' && <ByttTilVeileder />}
<InnloggetBrukerContext.Provider value={innloggetBruker}>
{props.children}
</InnloggetBrukerContext.Provider>
Expand Down
53 changes: 44 additions & 9 deletions src/Router/Router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,17 @@ const router = createBrowserRouter(
path: Path.OVERSIKT,
element: (
<FeilVarselProvider>
<FeatureToggleProvider>
<RedirectEtterLogin>
<AlleredeOpprettetAvtaleProvider>
<NotifikasjonWidgetProvider>
<Outlet />
</NotifikasjonWidgetProvider>
</AlleredeOpprettetAvtaleProvider>
</RedirectEtterLogin>
</FeatureToggleProvider>
<InnloggingBoundary>
<FeatureToggleProvider>
<RedirectEtterLogin>
<AlleredeOpprettetAvtaleProvider>
<NotifikasjonWidgetProvider>
<Outlet />
</NotifikasjonWidgetProvider>
</AlleredeOpprettetAvtaleProvider>
</RedirectEtterLogin>
</FeatureToggleProvider>
</InnloggingBoundary>
</FeilVarselProvider>
),
children: [
Expand All @@ -84,6 +86,39 @@ const router = createBrowserRouter(
path: Path.OPPRETT_AVTALE_ARBEIDSGIVER,
element: <OpprettAvtaleArbeidsgiver />,
},
{
path: Path.AVTALE,
element: (
<AvtaleProvider>
<AvtaleFetcher>
<Outlet />
</AvtaleFetcher>
</AvtaleProvider>
),
errorElement: <AvtaleRouteError />,
children: [
{
path: Path.AVTALE,
element: <AvtaleSide />,
},
{
path: Path.AVTALE_STEG,
element: <AvtaleSide />,
},
{
path: Path.AVTALE_BESLUTTER,
element: <BeslutterSide />,
},
{
path: Path.AVTALE_BESLUTTER_TILSKUDDSPERIODE,
element: <BeslutterSide />,
},
{
path: Path.AVTALE_SLETT,
element: <Slettemerk />,
},
],
},
],
},
],
Expand Down

0 comments on commit 8c0abbb

Please sign in to comment.