text: import React, { Component } from 'react';
  import { Redirect } from 'react-router-dom';
  import AuthService from '../services/auth';
  import axios from 'axios';
  
  export default class Profile extends Component {
      constructor(props) {
          super(props);
  
          this.state = {
              redirect: null,
              userReady: false,
              currentUser: { username: '', email: '' },
          };
      }
  
      componentDidMount() {
          const currentUser = AuthService.getCurrentUser();
  
          console.log(currentUser);
  
          if (!(currentUser.accessToken && currentUser.accessToken.length)) {
              this.setState({ redirect: '/' });
          }
          this.setState({ currentUser: currentUser, userReady: true });
      }
  
      render() {
          if (this.state.redirect) {
              return <Redirect to={this.state.redirect} />;
          }
  
          const { currentUser } = this.state;
  
          return (
              <div className='container'>
                  <h2>Profile</h2>
  
                  <h4>Username: {currentUser.username}</h4>
                  <h4>Email: {currentUser.email}</h4>
              </div>
          );
      }
  }
  