From 3969face39ecc933b1cb9c7625be921d148552cb Mon Sep 17 00:00:00 2001 From: ilyayudovin Date: Sun, 14 Jun 2020 01:31:05 +0300 Subject: feat: add sing in form --- src/ProfileInfo/ProfileInfo.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/ProfileInfo') diff --git a/src/ProfileInfo/ProfileInfo.tsx b/src/ProfileInfo/ProfileInfo.tsx index a7289df..693f550 100644 --- a/src/ProfileInfo/ProfileInfo.tsx +++ b/src/ProfileInfo/ProfileInfo.tsx @@ -1,11 +1,13 @@ import React, { useState } from 'react'; import { Avatar } from '@material-ui/core/'; import { makeStyles } from '@material-ui/core/styles'; +import Button from '@material-ui/core/Button/Button'; import { User } from '../types'; import { get } from '../requests'; interface PropTypes { id: string; + setUser: (newUser: User | undefined) => void; } const useStyles = makeStyles({ @@ -34,7 +36,7 @@ const useStyles = makeStyles({ } }); -const ProfileInfo: React.FC = ({ id }) => { +const ProfileInfo: React.FC = ({ id, setUser }) => { const [userInfo, setUserInfo] = useState(); get(`/users/${id}`).then(response => { @@ -43,6 +45,11 @@ const ProfileInfo: React.FC = ({ id }) => { const classes = useStyles(); + const LogOut = () => { + localStorage.clear(); + setUser(undefined); + }; + return (
@@ -60,6 +67,7 @@ const ProfileInfo: React.FC = ({ id }) => { Following
+ ); }; -- cgit v1.2.3