From c311c538a3442aed8d77449736f28be66feea57c Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sun, 14 Jun 2020 22:42:52 +0300 Subject: feat: configure navigation --- src/pages/ProfilePage/ProfilePage.tsx | 9 +++++---- 1 file changed, 5 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 984fb1e..46637cb 100644 --- a/src/pages/ProfilePage/ProfilePage.tsx +++ b/src/pages/ProfilePage/ProfilePage.tsx @@ -6,10 +6,11 @@ import { get } from '../../requests'; interface PropTypes { logOut: () => void; + navigate: (prefix: string, id: string) => void; id: string; } -const ProfilePage: React.FC = ({ logOut, id }) => { +const ProfilePage: React.FC = ({ logOut, id, navigate }) => { const [userInfo, setUserInfo] = useState(); const [polls, setPolls] = useState([]); @@ -17,19 +18,19 @@ const ProfilePage: React.FC = ({ logOut, id }) => { get(`/users/${id}`).then(response => { setUserInfo(response.data); }); - },[]); + }, [id]); useEffect(() => { get(`/profiles/${id}`).then(response => { setPolls(response.data); }); - },[]); + }, [id]); return ( <> - + ); }; -- cgit v1.2.3 From 2a65284a385915818ca5f3e3b7354554e19af9cb Mon Sep 17 00:00:00 2001 From: eug-vs Date: Mon, 15 Jun 2020 15:52:40 +0300 Subject: style: fix eslint errors --- src/pages/ProfilePage/ProfilePage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/pages/ProfilePage/ProfilePage.tsx') diff --git a/src/pages/ProfilePage/ProfilePage.tsx b/src/pages/ProfilePage/ProfilePage.tsx index 46637cb..0f5fb2b 100644 --- a/src/pages/ProfilePage/ProfilePage.tsx +++ b/src/pages/ProfilePage/ProfilePage.tsx @@ -1,4 +1,4 @@ -import React, { useState,useEffect } from 'react'; +import React, { useState, useEffect } from 'react'; import { User, Poll } from '../../types'; import ProfileInfo from './ProfileInfo'; import Feed from '../../components/Feed/Feed'; -- cgit v1.2.3