text: import React, {Component} from "react";
  import PropTypes from "prop-types";
  import {connect} from "react-redux";
  import {logoutUser} from "../../actions/authActions";
  import {Redirect} from "react-router-dom";
  
  class Dashboard extends Component {
      onLogoutClick = e => {
          e.preventDefault();
          this.props.logoutUser();
      };
  
      render() {
          const {user} = this.props.auth;
          if (user.role === 3) {
              return <Redirect to="/all-courses"/>
          } else if (user.role === 1) {
              return <Redirect to="/admin"/>
          } else if (user.role === 2) {
              return <Redirect to="/instructor"/>
          } else {
              return <Redirect to="/"/>
          }
      }
  }
  
  Dashboard.propTypes = {
      logoutUser: PropTypes.func.isRequired,
      auth: PropTypes.object.isRequired
  };
  const mapStateToProps = state => ({
      auth: state.auth
  });
  export default connect(
      mapStateToProps,
      {logoutUser}
  )(Dashboard);
  