diff options
Diffstat (limited to 'src/pages')
-rw-r--r-- | src/pages/Page.tsx | 40 | ||||
-rw-r--r-- | src/pages/urls.ts | 2 |
2 files changed, 20 insertions, 22 deletions
diff --git a/src/pages/Page.tsx b/src/pages/Page.tsx index 47f5f50..f5c975c 100644 --- a/src/pages/Page.tsx +++ b/src/pages/Page.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { makeStyles, useTheme } from '@material-ui/core/styles'; import { useMediaQuery } from '@material-ui/core'; import { SnackbarProvider } from 'notistack'; -import { BrowserRouter, Switch } from 'react-router-dom'; +import { Switch } from 'react-router-dom'; import ProfilePage from './ProfilePage/ProfilePage'; import FeedPage from './FeedPage/FeedPage'; @@ -32,26 +32,24 @@ const Page: React.FC = () => { const isMobile = useMediaQuery(theme.breakpoints.down('sm')); return ( - <BrowserRouter> - <SnackbarProvider - maxSnack={3} - anchorOrigin={{ - vertical: isMobile ? 'top' : 'bottom', - horizontal: 'right' - }} - > - <div className={classes.root}> - <Switch> - <Route exact path={urls.home} component={HomePage} /> - <Route exact path={urls.login} component={LoginPage} /> - <Route exact path={urls.registration} component={RegistrationPage} /> - <Route exact path={urls.feed} component={FeedPage} /> - <Route exact path={urls.notifications} component={NotificationsPage} /> - <Route path={urls.profile} component={ProfilePage} /> - </Switch> - </div> - </SnackbarProvider> - </BrowserRouter> + <SnackbarProvider + maxSnack={3} + anchorOrigin={{ + vertical: isMobile ? 'top' : 'bottom', + horizontal: 'right' + }} + > + <div className={classes.root}> + <Switch> + <Route exact path={urls.home} component={HomePage} /> + <Route exact path={urls.login} component={LoginPage} /> + <Route exact path={urls.registration} component={RegistrationPage} /> + <Route exact path={urls.feed} component={FeedPage} /> + <Route exact path={urls.notifications} component={NotificationsPage} /> + <Route path={urls.profile()} component={ProfilePage} /> + </Switch> + </div> + </SnackbarProvider> ); }; diff --git a/src/pages/urls.ts b/src/pages/urls.ts index 3a05f39..e10edac 100644 --- a/src/pages/urls.ts +++ b/src/pages/urls.ts @@ -2,7 +2,7 @@ export default { home: '/', login: '/login', registration: '/registration', - profile: '/profile', + profile: (username: string = '') => `/profile/${username.toLowerCase()}`, feed: '/feed', notifications: '/notifications' }; |