-
Notifications
You must be signed in to change notification settings - Fork 1
/
App.tsx
39 lines (35 loc) · 1.42 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
36
37
38
39
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import './App.scss';
import { iModelId, clientId } from './env';
import { useAuthContext } from './auth/AuthContext';
import { CompleteSignIn } from './auth/CompleteSignIn';
import { Login } from './auth/Login';
import { LocationProvider, Router } from '@reach/router';
import { SynchronizationPage } from './components/synchronizationPage/synchronizationPage';
import { SynchronizationAuthWrapper } from './auth/SynchronizationAuthWrapper';
import { Layout } from './components/layout/layout';
const App = (): JSX.Element => {
const { user } = useAuthContext();
return iModelId && clientId ? (
<LocationProvider>
<Layout>
<Router>
<CompleteSignIn path="/signin-oidc" />
{user === null || user.expired ? (
<Login path="/*" />
) : (
<SynchronizationAuthWrapper path="/" user={user}>
<SynchronizationPage path="/" />
</SynchronizationAuthWrapper>
)}
</Router>
</Layout>
</LocationProvider>
) : (
<div>Application is not configured.</div>
);
};
export default App;