import React, { Component } from 'react' import { withRouter } from 'react-router-dom' import styles from './Dashboard.module.css' import { getSession, deleteSession } from '../../utils' class Dashboard extends Component { constructor(props) { super(props) this.state = {} // Bindings this.logout = this.logout.bind(this) } async componentDidMount() { const userSession = getSession() this.setState({ session: userSession, }) } /** * Log user out by clearing cookie and redirecting */ logout() { deleteSession() this.props.history.push(`/`) } render() { return (
{ /* Navigation */ }
{ this.state.session ? this.state.session.userEmail : '' }
logout
{ /* Content */ }
serverless-fullstack-application
Welcome to your serverless fullstack dashboard...
) } } export default withRouter(Dashboard)