aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/components/UserStrip/UserStrip.tsx7
-rw-r--r--src/pages/ProfilePage/ProfilePage.tsx5
2 files changed, 7 insertions, 5 deletions
diff --git a/src/components/UserStrip/UserStrip.tsx b/src/components/UserStrip/UserStrip.tsx
index 3ac47b3..a2d2700 100644
--- a/src/components/UserStrip/UserStrip.tsx
+++ b/src/components/UserStrip/UserStrip.tsx
@@ -1,10 +1,11 @@
import React from 'react';
+import { useHistory } from 'react-router-dom';
import { makeStyles } from '@material-ui/core/styles';
import VerifiedIcon from '@material-ui/icons/CheckCircleOutline';
import { Avatar, CardHeader } from '@material-ui/core/';
import { User } from 'which-types';
-import { useNavigate } from '../../hooks/useNavigate';
+import urls from '../../pages/urls';
interface PropTypes {
user: User;
@@ -30,11 +31,11 @@ const useStyles = makeStyles(theme => ({
const UserStrip: React.FC<PropTypes> = ({ user, info }) => {
const classes = useStyles();
- const { navigate } = useNavigate();
+ const history = useHistory();
const { username, avatarUrl, verified } = user;
const handleNavigate = () => {
- navigate('profile', user._id);
+ history.push(urls.profile(user.username));
};
const avatar = (
diff --git a/src/pages/ProfilePage/ProfilePage.tsx b/src/pages/ProfilePage/ProfilePage.tsx
index b81c70f..ec917fd 100644
--- a/src/pages/ProfilePage/ProfilePage.tsx
+++ b/src/pages/ProfilePage/ProfilePage.tsx
@@ -7,6 +7,7 @@ import ProfileInfo from './ProfileInfo';
import Feed from '../../components/Feed/Feed';
import { get } from '../../requests';
import { useAuth } from '../../hooks/useAuth';
+import urls from '../urls';
const ProfilePage: React.FC = () => {
@@ -23,8 +24,8 @@ const ProfilePage: React.FC = () => {
setIsInfoLoading(true);
const redirect = () => {
- if (user) history.push(`/profile/${user.username}`);
- else history.push('/login');
+ if (user) history.push(urls.profile(user.username));
+ else history.push(urls.login);
};
if (username) {