diff options
author | eug-vs <eug-vs@keemail.me> | 2020-08-07 21:58:31 +0300 |
---|---|---|
committer | eug-vs <eug-vs@keemail.me> | 2020-08-07 21:58:58 +0300 |
commit | 056ef91e36f86a3278dfbb2f369939534bffe7e2 (patch) | |
tree | 4f0f6f5b3cc4475560d315bc64b43beddcadae2a /src | |
parent | d9c74d25ab1f4e13cb980074e188ef6125d2d290 (diff) | |
download | which-ui-056ef91e36f86a3278dfbb2f369939534bffe7e2.tar.gz |
refactor: move urls to separate file
Diffstat (limited to 'src')
-rw-r--r-- | src/pages/Page.tsx | 12 | ||||
-rw-r--r-- | src/pages/PrivateRoute.tsx | 9 | ||||
-rw-r--r-- | src/pages/urls.ts | 8 |
3 files changed, 10 insertions, 19 deletions
diff --git a/src/pages/Page.tsx b/src/pages/Page.tsx index 62b6b61..85b351c 100644 --- a/src/pages/Page.tsx +++ b/src/pages/Page.tsx @@ -9,8 +9,8 @@ import FeedPage from './FeedPage/FeedPage'; import AuthPage from './AuthPage/AuthPage'; import HomePage from './HomePage/HomePage'; import NotificationsPage from './NotificationsPage/NotificationsPage'; -import { useNavigate } from '../hooks/useNavigate'; import PrivateRoute from './PrivateRoute'; +import urls from './urls'; const useStyles = makeStyles(theme => ({ @@ -25,17 +25,7 @@ const useStyles = makeStyles(theme => ({ })); -const urls = { - home: '/', - login: '/login', - registration: '/registration', - profile: '/profile', - feed: '/feed', - notifications: '/notifications' -}; - const Page: React.FC = () => { - const { page } = useNavigate(); const classes = useStyles(); const theme = useTheme(); const isMobile = useMediaQuery(theme.breakpoints.down('sm')); diff --git a/src/pages/PrivateRoute.tsx b/src/pages/PrivateRoute.tsx index cdee67b..685e53d 100644 --- a/src/pages/PrivateRoute.tsx +++ b/src/pages/PrivateRoute.tsx @@ -1,15 +1,8 @@ import React from 'react'; import { Redirect, Route } from 'react-router-dom'; import { useAuth } from '../hooks/useAuth'; +import urls from './urls'; -const urls = { - home: '/', - login: '/login', - registration: '/registration', - profile: '/profile', - feed: '/feed', - notifications: '/notifications' -}; const PrivateRoute: React.FC<any> = ({ component: ProtectedComponent, ...rest }) => { const { isAuthenticated } = useAuth(); diff --git a/src/pages/urls.ts b/src/pages/urls.ts new file mode 100644 index 0000000..3a05f39 --- /dev/null +++ b/src/pages/urls.ts @@ -0,0 +1,8 @@ +export default { + home: '/', + login: '/login', + registration: '/registration', + profile: '/profile', + feed: '/feed', + notifications: '/notifications' +}; |