import React, { useState, useEffect } from 'react'; import { User, Poll } from 'which-types'; import ProfileInfo from './ProfileInfo'; import Feed from '../../components/Feed/Feed'; import { get } from '../../requests'; interface PropTypes { logOut: () => void; navigate: (prefix: string, id: string) => void; id: string; } const ProfilePage: React.FC = ({ logOut, id, navigate }) => { const [userInfo, setUserInfo] = useState(); const [polls, setPolls] = useState([]); const [totalVotes, setTotalVotes] = useState(0); useEffect(() => { get(`/users/${id}`).then(response => { setUserInfo(response.data); }); }, [id]); useEffect(() => { get(`/profiles/${id}`).then(response => { setPolls(response.data); // const x = response.data.reduce((a: any, c: any) => a.contents.left.votes + c.contents.left.votes); // const y = response.data.reduce((a: any, c: any) => a.contents.right.votes + c.contents.right.votes); let sum = 0; for(let i = 0;i ); }; export default ProfilePage;