-
Notifications
You must be signed in to change notification settings - Fork 682
/
routes.js
38 lines (34 loc) · 1.36 KB
/
routes.js
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
import React, { Suspense } from 'react';
import { Route, Switch, useLocation } from 'react-router-dom';
import { useScrollTopOnChange } from '@magento/peregrine/lib/hooks/useScrollTopOnChange';
import { fullPageLoadingIndicator } from '../LoadingIndicator';
import HomePage from '../HomePage';
import MagentoRoute from '../MagentoRoute';
const Routes = () => {
const { pathname } = useLocation();
useScrollTopOnChange(pathname);
return (
<Suspense fallback={fullPageLoadingIndicator}>
<Switch>
{/*
* Client-side routes are injected by BabelRouteInjectionPlugin here.
* Venia's are defined in packages/venia-ui/lib/targets/venia-ui-intercept.js
*/}
<Route>
<MagentoRoute />
{/*
* The Route below is purposefully nested with the MagentoRoute above.
* MagentoRoute renders the CMS page, and HomePage adds a stylesheet.
* HomePage would be obsolete if the CMS could deliver a stylesheet.
*/}
<Route exact path="/">
<HomePage />
</Route>
</Route>
</Switch>
</Suspense>
);
};
export default Routes;
const availableRoutes = [];
export { availableRoutes };