From 1ac600e2fd9024604d98c525957cd2fbfdf9a779 Mon Sep 17 00:00:00 2001
From: ilyayudovin <ilyayudovin123@gmail.com>
Date: Fri, 12 Jun 2020 18:29:51 +0300
Subject: feat: take user info from database

---
 src/ProfileInfo/ProfileInfo.tsx | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

(limited to 'src/ProfileInfo/ProfileInfo.tsx')

diff --git a/src/ProfileInfo/ProfileInfo.tsx b/src/ProfileInfo/ProfileInfo.tsx
index ac8ef26..05a2b78 100644
--- a/src/ProfileInfo/ProfileInfo.tsx
+++ b/src/ProfileInfo/ProfileInfo.tsx
@@ -1,10 +1,11 @@
-import React from 'react';
+import React, {useEffect, useState} from 'react';
 import { Avatar } from '@material-ui/core/';
 import { makeStyles } from '@material-ui/core/styles';
-import { Poll } from '../types';
+import {Poll, User} from "../types";
+import {get} from "../requests";
 
 interface PropTypes {
-  profile: Poll;
+  id: string;
 }
 
 const useStyles = makeStyles({
@@ -33,14 +34,22 @@ const useStyles = makeStyles({
   }
 });
 
-const ProfileInfo: React.FC<PropTypes> = ({ profile }) => {
+const ProfileInfo: React.FC<PropTypes> = ({ id }) => {
+  const [userInfo, setUserInfo] = useState<User>();
+
+  let endpoint: string = '/users/' + id;
+
+  get(endpoint).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}>
-- 
cgit v1.2.3


From 282bd3180b149571cfc5caad98d8b462596157ef Mon Sep 17 00:00:00 2001
From: ilyayudovin <ilyayudovin123@gmail.com>
Date: Fri, 12 Jun 2020 19:41:54 +0300
Subject: fix: clear eslint errors

---
 src/ProfileInfo/ProfileInfo.tsx | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

(limited to 'src/ProfileInfo/ProfileInfo.tsx')

diff --git a/src/ProfileInfo/ProfileInfo.tsx b/src/ProfileInfo/ProfileInfo.tsx
index 05a2b78..2bba586 100644
--- a/src/ProfileInfo/ProfileInfo.tsx
+++ b/src/ProfileInfo/ProfileInfo.tsx
@@ -1,8 +1,8 @@
-import React, {useEffect, useState} from 'react';
+import React, { useState } from 'react';
 import { Avatar } from '@material-ui/core/';
 import { makeStyles } from '@material-ui/core/styles';
-import {Poll, User} from "../types";
-import {get} from "../requests";
+import { User } from '../types';
+import { get } from '../requests';
 
 interface PropTypes {
   id: string;
@@ -37,10 +37,8 @@ const useStyles = makeStyles({
 const ProfileInfo: React.FC<PropTypes> = ({ id }) => {
   const [userInfo, setUserInfo] = useState<User>();
 
-  let endpoint: string = '/users/' + id;
-
-  get(endpoint).then(response => {
-    setUserInfo(response.data)
+  get(`/users/ + ${id}`).then(response => {
+    setUserInfo(response.data);
   });
 
   const classes = useStyles();
-- 
cgit v1.2.3


From 0d878909fe17311910f2ba13e203bdfa1bc72a1e Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Fri, 12 Jun 2020 19:58:36 +0300
Subject: feat: fetch default user

---
 src/ProfileInfo/ProfileInfo.tsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src/ProfileInfo/ProfileInfo.tsx')

diff --git a/src/ProfileInfo/ProfileInfo.tsx b/src/ProfileInfo/ProfileInfo.tsx
index 2bba586..a7289df 100644
--- a/src/ProfileInfo/ProfileInfo.tsx
+++ b/src/ProfileInfo/ProfileInfo.tsx
@@ -37,7 +37,7 @@ const useStyles = makeStyles({
 const ProfileInfo: React.FC<PropTypes> = ({ id }) => {
   const [userInfo, setUserInfo] = useState<User>();
 
-  get(`/users/ + ${id}`).then(response => {
+  get(`/users/${id}`).then(response => {
     setUserInfo(response.data);
   });
 
-- 
cgit v1.2.3

