diff options
author | ilyayudovin <46264063+ilyayudovin@users.noreply.github.com> | 2020-06-12 20:00:50 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-12 20:00:50 +0300 |
commit | 57a2ff3cfa7eae111bb8f46447198586c47425fb (patch) | |
tree | 14c1bda2c6d42b5792cb7bf070b07df316c10825 /src/ProfileInfo/ProfileInfo.tsx | |
parent | f0f192e09993eedc2c9596bcdb520a96f5cfacdb (diff) | |
parent | 0d878909fe17311910f2ba13e203bdfa1bc72a1e (diff) | |
download | which-ui-57a2ff3cfa7eae111bb8f46447198586c47425fb.tar.gz |
Merge pull request #27 from ilyayudovin/profileInfo
ProfileInfo integration
Diffstat (limited to 'src/ProfileInfo/ProfileInfo.tsx')
-rw-r--r-- | src/ProfileInfo/ProfileInfo.tsx | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/ProfileInfo/ProfileInfo.tsx b/src/ProfileInfo/ProfileInfo.tsx index ac8ef26..a7289df 100644 --- a/src/ProfileInfo/ProfileInfo.tsx +++ b/src/ProfileInfo/ProfileInfo.tsx @@ -1,10 +1,11 @@ -import React from 'react'; +import React, { useState } from 'react'; import { Avatar } from '@material-ui/core/'; import { makeStyles } from '@material-ui/core/styles'; -import { Poll } from '../types'; +import { User } from '../types'; +import { get } from '../requests'; interface PropTypes { - profile: Poll; + id: string; } const useStyles = makeStyles({ @@ -33,14 +34,20 @@ const useStyles = makeStyles({ } }); -const ProfileInfo: React.FC<PropTypes> = ({ profile }) => { +const ProfileInfo: React.FC<PropTypes> = ({ id }) => { + const [userInfo, setUserInfo] = useState<User>(); + + get(`/users/${id}`).then(response => { + setUserInfo(response.data); + }); + const classes = useStyles(); return ( <div> - <Avatar className={classes.avatar} src={profile.author.avatarUrl} /> + <Avatar className={classes.avatar} src={userInfo?.avatarUrl} /> <div className={classes.name}> - Nick Name + {userInfo?.name} </div> <div className={classes.profileMenu}> <div style={{ borderBottom: '1px solid green', color: 'green' }} className={classes.menuButton}> |