accounts-frontend/packages/app/shell/App.tsx

34 lines
1.1 KiB
TypeScript
Raw Normal View History

import { hot } from 'react-hot-loader/root';
2019-12-30 14:17:29 +05:30
import React from 'react';
import { Route, Switch } from 'react-router-dom';
2019-12-30 14:17:29 +05:30
import { History } from 'history';
import { Store } from 'app/reducers';
import AuthFlowRoute from 'app/containers/AuthFlowRoute';
import RootPage from 'app/pages/root/RootPage';
2019-12-30 13:45:40 +05:30
import { ComponentLoader } from 'app/components/ui/loader';
import ContextProvider from './ContextProvider';
2019-12-30 13:45:40 +05:30
const SuccessOauthPage = React.lazy(() =>
import(
/* webpackChunkName: "page-oauth-success" */ 'app/pages/auth/SuccessOauthPage'
),
);
2019-12-30 14:17:29 +05:30
const App = ({ store, history }: { store: Store; history: History<any> }) => (
<ContextProvider store={store} history={history}>
2019-12-30 13:45:40 +05:30
<React.Suspense fallback={<ComponentLoader />}>
<Switch>
<Route path="/oauth2/code/success" component={SuccessOauthPage} />
<AuthFlowRoute
path="/oauth2/:version(v\d+)/:clientId?"
component={() => null}
/>
<Route path="/" component={RootPage} />
</Switch>
</React.Suspense>
</ContextProvider>
);
export default hot(App);