-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
35 lines (28 loc) · 1.14 KB
/
App.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import * as React from 'react';
import '@navikt/ds-css';
import '@navikt/ds-css-internal';
import { Modal } from '@navikt/ds-react';
import { type ISaksbehandler } from '@navikt/familie-typer';
import Container from './Container';
import ErrorBoundary from './Felleskomponenter/ErrorBoundary/ErrorBoundary';
import { hentInnloggetBruker } from '../api/saksbehandler';
import { AppProvider } from '../context/AppContext';
Modal?.setAppElement?.(document.getElementById('modal-a11y-wrapper'));
const App: React.FC = () => {
const [autentisertSaksbehandler, settAutentisertSaksbehandler] = React.useState<
ISaksbehandler | undefined
>(undefined);
React.useEffect(() => {
hentInnloggetBruker().then((innhentetInnloggetSaksbehandler: ISaksbehandler) => {
settAutentisertSaksbehandler(innhentetInnloggetSaksbehandler);
});
}, []);
return (
<ErrorBoundary autentisertSaksbehandler={autentisertSaksbehandler}>
<AppProvider autentisertSaksbehandler={autentisertSaksbehandler}>
<Container />
</AppProvider>
</ErrorBoundary>
);
};
export default App;