var express = require('express');
var router = express.Router();
var ntr = require("../neutral-functions.js")

/* GET home page. */
router.get('/', function(req, res, next) {

  
  ntr.checkUser()

  var check = ntr.checkToken(req, res) 

  if(check.name == false) {

    res.redirect(302, "/login")
    
  } else {

    console.log(ntr.getFullName(check.name))

    res.render('index', { title: ntr.getFullName(check.name), username: ntr.getFullName(check.name), accountpic: '<img width="200" class="w-25 sidebar-image noside" src="images/userspics/' + check.name + '.png">' });
  }

  
});

module.exports = router;
