{"size": 901, "ext": "js", "max_stars_repo_path": "controllers/dashboard-routes.js", "max_stars_repo_name": "jrjensen14/slp-goalden", "max_stars_repo_stars_event_min_datetime": "2021-01-28T15:39:51.000Z", "max_stars_repo_stars_event_max_datetime": "2021-01-28T15:39:51.000Z", "max_issues_repo_path": "controllers/dashboard-routes.js", "max_issues_repo_name": "jrjensen14/slp-goalden", "max_issues_repo_issues_event_min_datetime": "2021-01-27T02:59:41.000Z", "max_issues_repo_issues_event_max_datetime": "2021-02-04T21:44:34.000Z", "max_forks_repo_path": "controllers/dashboard-routes.js", "max_forks_repo_name": "jrjensen14/slp-goalden", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": 18, "max_forks_count": null, "avg_line_length": 25.0277777778, "max_line_length": 77, "alphanum_fraction": 0.5615982242}
const router = require("express").Router();
const sequelize = require("../config/connection");
const { User, Student, Goal, StudentGoal, Trial } = require("../models");
const withAuth = require("../utils/auth");

router.get("/", (req, res, next) => {
    if (req.session.loggedIn) {    
    return res.redirect("/students");
    } 
  
   return res.render("login");
});

// router.get("/dashboard", withAuth, (req, res) => {
//   // User.findOne where id = req.session.user_id
//   User.findOne({
//     where: {
//       id: req.session.user_id
//     },
//     attributes: [
//       "username"
//     ]
//   })
//   .then((dbUserData) => {
//     const username = dbUserData.username;
//     res.render("dashboard", { username, loggedIn: req.session.loggedIn });
//   })
//   .catch((err) => {
//     console.log(err);
//     res.status(500).json(err);
//   });
  
// });

module.exports = router;
