Add some split points for routes

This commit is contained in:
SleepWalker
2019-12-30 10:15:40 +02:00
parent 5428e53a86
commit 03e26209f4
4 changed files with 113 additions and 57 deletions

View File

@@ -4,20 +4,28 @@ import { Route, Switch } from 'react-router-dom';
import { Store } from 'app/reducers';
import AuthFlowRoute from 'app/containers/AuthFlowRoute';
import RootPage from 'app/pages/root/RootPage';
import SuccessOauthPage from 'app/pages/auth/SuccessOauthPage';
import { ComponentLoader } from 'app/components/ui/loader';
import ContextProvider from './ContextProvider';
const SuccessOauthPage = React.lazy(() =>
import(
/* webpackChunkName: "page-oauth-success" */ 'app/pages/auth/SuccessOauthPage'
),
);
const App = ({ store, history }: { store: Store; history: any }) => (
<ContextProvider store={store} history={history}>
<Switch>
<Route path="/oauth2/code/success" component={SuccessOauthPage} />
<AuthFlowRoute
path="/oauth2/:version(v\d+)/:clientId?"
component={() => null}
/>
<Route path="/" component={RootPage} />
</Switch>
<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>
);