From 0de06228f4b5e482b6f73230210225b332f0a2ff Mon Sep 17 00:00:00 2001 From: Eug-VS Date: Sun, 12 Jan 2020 16:02:25 +0300 Subject: Store user data in localStorage (optionally) --- src/pages/Profile/Profile.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/pages/Profile/Profile.js') diff --git a/src/pages/Profile/Profile.js b/src/pages/Profile/Profile.js index f2c44ef..af90a56 100644 --- a/src/pages/Profile/Profile.js +++ b/src/pages/Profile/Profile.js @@ -2,6 +2,7 @@ import React from 'react'; import Window from "../../components/Window/Window"; import { + Button, makeStyles, } from "@material-ui/core"; import Registration from "./Registration/Registration"; @@ -18,13 +19,21 @@ const useStyles = makeStyles(theme => ({ const Profile = ({ user, setUser }) => { const classes = useStyles(); + const handleLogout = () => { + setUser({ username: 'anonymous', id: null }); + localStorage.clear(); + }; + return ( <>
{ user.id? ( - +

You can always log out from your account!

+
): ( -- cgit v1.2.3