summaryrefslogtreecommitdiff
path: root/src/app/App.js
blob: bf564b0dca8e0cf04cf7c2a0601277eb6d273880 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { lazy, Suspense } from 'react';
import { useAuthState } from '../context/auth';

import LoadingIndicator from '../components/LoadingIndicator';

const AuthenticatedApp = lazy(() => import('./AuthenticatedApp'));
const UnauthenticatedApp = lazy(() => import('./UnauthenticatedApp'));

function App() {
  const { isAuthenticated } = useAuthState();

  return (
    <Suspense fallback={<LoadingIndicator isLoading />}>
      {isAuthenticated ? <AuthenticatedApp /> : <UnauthenticatedApp />}
    </Suspense>
  );
}

export default App;