diff options
-rw-r--r-- | src/components/Header/Header.tsx | 2 | ||||
-rw-r--r-- | src/pages/Page.tsx | 3 | ||||
-rw-r--r-- | src/pages/ProfilePage/ProfilePage.tsx | 7 | ||||
-rw-r--r-- | src/pages/Route.tsx | 11 |
4 files changed, 5 insertions, 18 deletions
diff --git a/src/components/Header/Header.tsx b/src/components/Header/Header.tsx index 9c42c31..5aa66ba 100644 --- a/src/components/Header/Header.tsx +++ b/src/components/Header/Header.tsx @@ -54,7 +54,7 @@ const Header: React.FC = () => { }; const handleFeed = (): void => { - history.push('/feed') + history.push('/feed'); }; const handleProfile = (): void => { diff --git a/src/pages/Page.tsx b/src/pages/Page.tsx index 34a1046..668b171 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 { Switch } from 'react-router-dom'; +import { Switch, Route } from 'react-router-dom'; import ProfilePage from './ProfilePage/ProfilePage'; import FeedPage from './FeedPage/FeedPage'; @@ -10,7 +10,6 @@ import LoginPage from './LoginPage/LoginPage'; import RegistrationPage from './RegistrationPage/RegistrationPage'; import HomePage from './HomePage/HomePage'; import NotificationsPage from './NotificationsPage/NotificationsPage'; -import Route from './Route'; const useStyles = makeStyles(theme => ({ diff --git a/src/pages/ProfilePage/ProfilePage.tsx b/src/pages/ProfilePage/ProfilePage.tsx index b81c70f..ae94b9f 100644 --- a/src/pages/ProfilePage/ProfilePage.tsx +++ b/src/pages/ProfilePage/ProfilePage.tsx @@ -29,12 +29,11 @@ const ProfilePage: React.FC = () => { if (username) { get(`/users?username=${username}`).then(response => { - if (!response.data.length) return redirect(); // TODO: handle this case + if (!response.data.length) redirect(); // TODO: handle this case setUserInfo(response.data[0]); setIsInfoLoading(false); }).catch(() => redirect()); - } else redirect() - + } else redirect(); }, [username, user, history]); @@ -54,7 +53,7 @@ const ProfilePage: React.FC = () => { )); }); } - }, [userInfo]) + }, [userInfo]); return ( <Container maxWidth="sm" disableGutters> diff --git a/src/pages/Route.tsx b/src/pages/Route.tsx deleted file mode 100644 index fdd6f96..0000000 --- a/src/pages/Route.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import React from 'react'; -import { Route as BaseRoute } from 'react-router-dom'; - - -const Route: React.FC<any> = ({ component: Component, ...rest }) => { - const render: React.FC<any> = (props) => <Component {...props} />; - - return <BaseRoute render={render} {...rest} />; -}; - -export default Route; |