-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Feat/404 (#1259)
* feat. fikset routing og satt opp data-routing fra react-router * feat. Håndtere 404 feil fra API og la opp default route for 404 * feat. få annullering av avtaler i retur
Showing
33 changed files
with
467 additions
and
385 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,124 +1,10 @@ | ||
import AvtaleFetcher from '@/AvtaleSide/AvtaleFetcher'; | ||
import AlleredeOpprettetAvtaleProvider from '@/komponenter/alleredeOpprettetTiltak/api/AlleredeOpprettetAvtaleProvider'; | ||
import Oversikt from '@/Oversikt'; | ||
import * as React from 'react'; | ||
import { BrowserRouter, Route, Routes } from 'react-router-dom'; | ||
import AdvarselBannerTestversjon from './AdvarselBannerTestversjon/AdvarselBannerTestversjon'; | ||
import AvtaleProvider from './AvtaleProvider'; | ||
import AvtaleSide from './AvtaleSide/AvtaleSide'; | ||
import BeslutterSide from './BeslutterSide/BeslutterSide'; | ||
import { FeatureToggleProvider } from './FeatureToggleProvider'; | ||
import { FeilVarselProvider } from './FeilVarselProvider'; | ||
import Informasjonsside from './Informasjonsside/Informasjonsside'; | ||
import InnloggingBoundary from './InnloggingBoundary/InnloggingBoundary'; | ||
import { VarselOmNedetid } from './InnloggingBoundary/VarselOmNedetid'; | ||
import ErrorBoundary from './komponenter/ErrorBoundary'; | ||
import Slettemerk from './komponenter/Slettemerk'; | ||
import { NotifikasjonWidgetProvider } from './NotifikasjonWidgetProvider'; | ||
import OpprettAvtaleArbeidsgiver from './OpprettAvtale/OpprettAvtaleArbeidsgiver/OpprettAvtaleArbeidsgiver'; | ||
import OpprettAvtaleVeileder from './OpprettAvtale/OpprettAvtaleVeileder/OpprettAvtaleVeileder'; | ||
import { RouterProvider } from 'react-router-dom'; | ||
|
||
import { | ||
basename, | ||
pathTilAvtale, | ||
pathTilInformasjonssideInnlogget, | ||
pathTilInformasjonssideUinnlogget, | ||
pathTilOpprettAvtale, | ||
pathTilOpprettAvtaleArbeidsgiver, | ||
pathTilStegIAvtale, | ||
} from './paths'; | ||
import RedirectEtterLogin from './RedirectEtterLogin'; | ||
import router from './Router'; | ||
|
||
class App extends React.Component { | ||
render() { | ||
return ( | ||
<ErrorBoundary> | ||
<BrowserRouter basename={basename}> | ||
<AdvarselBannerTestversjon /> | ||
<VarselOmNedetid /> | ||
<Routes> | ||
<Route path={pathTilInformasjonssideUinnlogget} element={<Informasjonsside />} /> | ||
<Route | ||
path="*" | ||
element={ | ||
<FeilVarselProvider> | ||
<InnloggingBoundary> | ||
<FeatureToggleProvider> | ||
<RedirectEtterLogin> | ||
<AlleredeOpprettetAvtaleProvider> | ||
<NotifikasjonWidgetProvider> | ||
<Routes> | ||
<Route path="/" element={<Oversikt />} /> | ||
<Route | ||
path={pathTilInformasjonssideInnlogget} | ||
element={<Informasjonsside />} | ||
/> | ||
<Route | ||
path={pathTilOpprettAvtale} | ||
element={<OpprettAvtaleVeileder />} | ||
/> | ||
<Route | ||
path={pathTilOpprettAvtaleArbeidsgiver} | ||
element={<OpprettAvtaleArbeidsgiver />} | ||
/> | ||
</Routes> | ||
<Routes> | ||
<Route | ||
path={pathTilAvtale(':avtaleId/*')} | ||
element={ | ||
<AvtaleProvider> | ||
<AvtaleFetcher> | ||
<Routes> | ||
<Route | ||
path="/" | ||
element={<AvtaleSide />} | ||
/> | ||
<Route | ||
path="/:stegPath" | ||
element={<AvtaleSide />} | ||
/> | ||
|
||
<Route | ||
path={`/beslutte/`} | ||
element={<BeslutterSide />} | ||
/> | ||
|
||
<Route | ||
path={`/beslutte/:tilskuddsperiodeId`} | ||
element={<BeslutterSide />} | ||
/> | ||
|
||
<Route | ||
path={`/slett`} | ||
element={<Slettemerk />} | ||
/> | ||
|
||
<Route | ||
path={pathTilStegIAvtale( | ||
':avtaleId', | ||
':stegPath', | ||
)} | ||
element={<AvtaleSide />} | ||
/> | ||
</Routes> | ||
</AvtaleFetcher> | ||
</AvtaleProvider> | ||
} | ||
/> | ||
</Routes> | ||
</NotifikasjonWidgetProvider> | ||
</AlleredeOpprettetAvtaleProvider> | ||
</RedirectEtterLogin> | ||
</FeatureToggleProvider> | ||
</InnloggingBoundary> | ||
</FeilVarselProvider> | ||
} | ||
/> | ||
</Routes> | ||
</BrowserRouter> | ||
</ErrorBoundary> | ||
); | ||
} | ||
function App() { | ||
return <RouterProvider router={router} />; | ||
} | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.container { | ||
display: flex; | ||
justify-content: center; | ||
margin-top: 10rem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 5 additions & 4 deletions
9
src/OpprettAvtale/OpprettAvtaleVeileder/InformasjonsboksTopVeilederOppretterAvtale.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { useRouteError } from 'react-router-dom'; | ||
|
||
import { IkkeFunnetError } from '@/types/errors'; | ||
import IkkeFunnet404 from '@/Router/IkkeFunnet404'; | ||
import { useInnloggetBruker } from '@/InnloggingBoundary/InnloggingBoundary'; | ||
|
||
function AvtaleRouteError() { | ||
const error = useRouteError(); | ||
const { rolle } = useInnloggetBruker(); | ||
|
||
if (error instanceof IkkeFunnetError) { | ||
return <IkkeFunnet404 rolle={rolle} />; | ||
} | ||
|
||
throw error; | ||
} | ||
|
||
export default AvtaleRouteError; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { Link } from 'react-router-dom'; | ||
import { Button, BodyShort, Box, Heading, List, Page, VStack } from '@navikt/ds-react'; | ||
|
||
import Innholdsboks from '@/komponenter/Innholdsboks/Innholdsboks'; | ||
import { Path } from '@/Router'; | ||
import { Rolle } from '@/types/innlogget-bruker'; | ||
|
||
interface Props { | ||
rolle?: Rolle; | ||
} | ||
|
||
function IkkeFunnet404(props: Props) { | ||
const { rolle = 'INGEN_ROLLE' } = props; | ||
|
||
return ( | ||
<Page.Block as="main" width="xl" gutters> | ||
<Box paddingBlock="20 16" data-aksel-template="404-v2"> | ||
<Innholdsboks> | ||
<VStack gap="12" align="start"> | ||
<div> | ||
<Heading level="1" size="large" spacing> | ||
Beklager, vi fant ikke siden | ||
</Heading> | ||
<BodyShort> | ||
Denne siden kan være slettet eller flyttet, eller det er en feil i lenken. | ||
</BodyShort> | ||
<List> | ||
<List.Item>Bruk gjerne søket eller menyen</List.Item> | ||
<List.Item> | ||
<Link to={Path.OVERSIKT}>Gå til forsiden</Link> | ||
</List.Item> | ||
</List> | ||
</div> | ||
{rolle === 'DELTAKER' && ( | ||
<Button as="a" href="https://www.nav.no/minside"> | ||
Gå til Min side | ||
</Button> | ||
)} | ||
{rolle === 'ARBEIDSGIVER' && ( | ||
<Button as="a" href="https://arbeidsgiver.nav.no/min-side-arbeidsgiver"> | ||
Gå til Min side | ||
</Button> | ||
)} | ||
</VStack> | ||
</Innholdsboks> | ||
</Box> | ||
</Page.Block> | ||
); | ||
} | ||
|
||
export default IkkeFunnet404; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
import * as React from 'react'; | ||
import { createBrowserRouter, Outlet } from 'react-router-dom'; | ||
|
||
import AdvarselBannerTestversjon from '@/AdvarselBannerTestversjon/AdvarselBannerTestversjon'; | ||
import AlleredeOpprettetAvtaleProvider from '@/komponenter/alleredeOpprettetTiltak/api/AlleredeOpprettetAvtaleProvider'; | ||
import AvtaleFetcher from '@/AvtaleSide/AvtaleFetcher'; | ||
import AvtaleProvider from '@/AvtaleProvider'; | ||
import AvtaleSide from '@/AvtaleSide/AvtaleSide'; | ||
import BeslutterSide from '@/BeslutterSide/BeslutterSide'; | ||
import IkkeFunnet404 from '@/Router/IkkeFunnet404'; | ||
import Informasjonsside from '@/Informasjonsside/Informasjonsside'; | ||
import InnloggingBoundary from '@/InnloggingBoundary/InnloggingBoundary'; | ||
import OpprettAvtaleArbeidsgiver from '@/OpprettAvtale/OpprettAvtaleArbeidsgiver/OpprettAvtaleArbeidsgiver'; | ||
import OpprettAvtaleVeileder from '@/OpprettAvtale/OpprettAvtaleVeileder/OpprettAvtaleVeileder'; | ||
import Oversikt from '@/Oversikt'; | ||
import RedirectEtterLogin from '@/RedirectEtterLogin'; | ||
import Slettemerk from '@/komponenter/Slettemerk'; | ||
import { FeatureToggleProvider } from '@/FeatureToggleProvider'; | ||
import { FeilVarselProvider } from '@/FeilVarselProvider'; | ||
import { NotifikasjonWidgetProvider } from '@/NotifikasjonWidgetProvider'; | ||
import { VarselOmNedetid } from '@/InnloggingBoundary/VarselOmNedetid'; | ||
import ErrorBoundary from '@/komponenter/ErrorBoundary'; | ||
import AvtaleRouteError from '@/Router/AvtaleRouteError'; | ||
|
||
export const basename = '/tiltaksgjennomforing'; | ||
|
||
export enum Path { | ||
OVERSIKT = '/', | ||
INFORMASJONSSIDE = '/informasjonsside', | ||
OPPRETT_AVTALE = '/opprett-avtale', | ||
OPPRETT_AVTALE_ARBEIDSGIVER = '/opprett-avtale-arbeidsgiver', | ||
AVTALE = '/avtale/:avtaleId', | ||
AVTALE_STEG = '/avtale/:avtaleId/:steg', | ||
AVTALE_BESLUTTER = '/avtale/:avtaleId/beslutter', | ||
AVTALE_BESLUTTER_TILSKUDDSPERIODE = '/avtale/:avtaleId/beslutter/:tilskuddsperiodeId', | ||
AVTALE_SLETT = '/avtale/:avtaleId/slett', | ||
} | ||
|
||
const router = createBrowserRouter( | ||
[ | ||
{ | ||
path: Path.OVERSIKT, | ||
element: ( | ||
<ErrorBoundary> | ||
<AdvarselBannerTestversjon /> | ||
<VarselOmNedetid /> | ||
<Outlet /> | ||
</ErrorBoundary> | ||
), | ||
children: [ | ||
{ | ||
path: '/*', | ||
element: <IkkeFunnet404 />, | ||
}, | ||
{ | ||
path: Path.INFORMASJONSSIDE, | ||
element: <Informasjonsside />, | ||
}, | ||
{ | ||
path: Path.OVERSIKT, | ||
element: ( | ||
<FeilVarselProvider> | ||
<InnloggingBoundary> | ||
<FeatureToggleProvider> | ||
<RedirectEtterLogin> | ||
<AlleredeOpprettetAvtaleProvider> | ||
<NotifikasjonWidgetProvider> | ||
<Outlet /> | ||
</NotifikasjonWidgetProvider> | ||
</AlleredeOpprettetAvtaleProvider> | ||
</RedirectEtterLogin> | ||
</FeatureToggleProvider> | ||
</InnloggingBoundary> | ||
</FeilVarselProvider> | ||
), | ||
children: [ | ||
{ | ||
path: Path.OVERSIKT, | ||
element: <Oversikt />, | ||
}, | ||
{ | ||
path: Path.OPPRETT_AVTALE, | ||
element: <OpprettAvtaleVeileder />, | ||
}, | ||
{ | ||
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 />, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
], | ||
{ basename }, | ||
); | ||
|
||
export default router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import Router from './Router'; | ||
export * from './Router'; | ||
|
||
export default Router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,5 @@ declare module '*.mp4' { | |
const src: string; | ||
export default src; | ||
} | ||
|
||
declare module '*.module.less'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters