aboutsummaryrefslogtreecommitdiff
path: root/src/pages/Profile/Profile.js
diff options
context:
space:
mode:
authorEug-VS <eug-vs@keemail.me>2020-01-12 16:02:25 +0300
committerEug-VS <eug-vs@keemail.me>2020-01-12 18:11:45 +0300
commit0de06228f4b5e482b6f73230210225b332f0a2ff (patch)
treefc73b4e0703e5d5b96290cfa22d71d57129d9c31 /src/pages/Profile/Profile.js
parent3ef3cb7f0b25a448e81e5b81738758f4545337cc (diff)
downloadchrono-cube-ui-0de06228f4b5e482b6f73230210225b332f0a2ff.tar.gz
Store user data in localStorage (optionally)
Diffstat (limited to 'src/pages/Profile/Profile.js')
-rw-r--r--src/pages/Profile/Profile.js11
1 files changed, 10 insertions, 1 deletions
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 (
<>
<Window type="primary">
<div className={classes.primary}>
{ user.id? (
<ContentSection sectionName={`Welcome back, ${user.username}`}>
-
+ <p> You can always log out from your account! </p>
+ <Button variant="contained" color="secondary" onClick={handleLogout}>
+ Logout
+ </Button>
</ContentSection>
): (
<Registration setUser={setUser} />