-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathProfilePage.js
40 lines (37 loc) · 1000 Bytes
/
ProfilePage.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import React from "react";
import { Route } from "react-router-dom";
import { Text, Button, Box } from "gestalt";
import "./ProfilePage.css";
class ProfilePage extends React.Component {
componentDidMount() {
if (this.props.match && !this.props.authenticated) {
this.props.history.push("/");
}
}
render() {
if (!this.props.match || !this.props.authenticated) {
return null;
}
return (
<div className="profile-page">
<Box marginBottom={6}>
<Text bold>{this.props.user ? this.props.user.email : "Oops! We could not find your email"}</Text>
</Box>
<Button
accesibilityLabel="Logout"
inline
text="Logout"
onClick={() => {
this.props.logout();
this.props.history.push("/");
}}
/>
</div>
);
}
}
export default props => (
<Route exact path="/profile">
{routerProps => <ProfilePage {...props} {...routerProps} />}
</Route>
);