From b446a83ff24ed5ea2233c544446557ee29f44364 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sat, 8 Aug 2020 09:49:38 +0300 Subject: refactor: use native Route component --- src/pages/ProfilePage/ProfilePage.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/pages/ProfilePage/ProfilePage.tsx') 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 ( -- cgit v1.2.3