|
1 | | -import React from 'react'; |
| 1 | +import React, { useEffect } from 'react'; |
| 2 | +import ReactGA from 'react-ga'; |
2 | 3 | import { Route, RouteComponentProps, Switch } from 'react-router-dom'; |
3 | 4 | import LoginContainer from '@/components/auth/LoginContainer'; |
4 | 5 | import ForgotPasswordContainer from '@/components/auth/ForgotPasswordContainer'; |
5 | 6 | import ResetPasswordContainer from '@/components/auth/ResetPasswordContainer'; |
6 | 7 | import LoginCheckpointContainer from '@/components/auth/LoginCheckpointContainer'; |
7 | 8 | import NotFound from '@/components/screens/NotFound'; |
8 | 9 |
|
9 | | -export default ({ location, history, match }: RouteComponentProps) => ( |
10 | | - <div className={'pt-8 xl:pt-32'}> |
11 | | - <Switch location={location}> |
12 | | - <Route path={`${match.path}/login`} component={LoginContainer} exact/> |
13 | | - <Route path={`${match.path}/login/checkpoint`} component={LoginCheckpointContainer}/> |
14 | | - <Route path={`${match.path}/password`} component={ForgotPasswordContainer} exact/> |
15 | | - <Route path={`${match.path}/password/reset/:token`} component={ResetPasswordContainer}/> |
16 | | - <Route path={`${match.path}/checkpoint`}/> |
17 | | - <Route path={'*'}> |
18 | | - <NotFound onBack={() => history.push('/auth/login')}/> |
19 | | - </Route> |
20 | | - </Switch> |
21 | | - </div> |
22 | | -); |
| 10 | +export default ({ location, history, match }: RouteComponentProps) => { |
| 11 | + useEffect(() => { |
| 12 | + ReactGA.pageview(location.pathname); |
| 13 | + }, [ location.pathname ]); |
| 14 | + |
| 15 | + return ( |
| 16 | + <div className={'pt-8 xl:pt-32'}> |
| 17 | + <Switch location={location}> |
| 18 | + <Route path={`${match.path}/login`} component={LoginContainer} exact/> |
| 19 | + <Route path={`${match.path}/login/checkpoint`} component={LoginCheckpointContainer}/> |
| 20 | + <Route path={`${match.path}/password`} component={ForgotPasswordContainer} exact/> |
| 21 | + <Route path={`${match.path}/password/reset/:token`} component={ResetPasswordContainer}/> |
| 22 | + <Route path={`${match.path}/checkpoint`} /> |
| 23 | + <Route path={'*'}> |
| 24 | + <NotFound onBack={() => history.push('/auth/login')} /> |
| 25 | + </Route> |
| 26 | + </Switch> |
| 27 | + </div> |
| 28 | + ); |
| 29 | +}; |
0 commit comments