{"size": 703, "ext": "js", "max_stars_repo_path": "src/components/Dashboard.js", "max_stars_repo_name": "MatthewEllisTx/Front-end", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/components/Dashboard.js", "max_issues_repo_name": "MatthewEllisTx/Front-end", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/components/Dashboard.js", "max_forks_repo_name": "MatthewEllisTx/Front-end", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 19.5277777778, "max_line_length": 105, "alphanum_fraction": 0.6358463727}

import { useContext, useEffect, useState } from 'react';
import { useHistory } from 'react-router-dom';

import UserContext from 'contexts/UserContext';



// Dashboard automatically routes user to the correct dashboard based on the account type of their token.
const Dashboard = (props) => {

  const history = useHistory();

  const { currentUser } = useContext(UserContext);

  useEffect(() => {
    switch(currentUser?.accountype) {
      case 'student':
        history.push('/dashboard/client');
        break;

      case 'instructor':
        history.push('/dashboard/instructor');
        break;

      default:
        break;
    }
  });

  return (
    <></>
  )
}

export default Dashboard;