From 64665a3d0bdb4bbf6a29571295ea33d9a0c7446a Mon Sep 17 00:00:00 2001 From: Haris Razis Date: Sun, 20 Dec 2020 21:12:42 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20Change=20arrow=20func=20and=20va?= =?UTF-8?q?l?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/routes/auth.js | 13 ++++++++----- server/services/socket.js | 1 - 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/server/routes/auth.js b/server/routes/auth.js index 70886f0..7e20bf0 100644 --- a/server/routes/auth.js +++ b/server/routes/auth.js @@ -1,17 +1,20 @@ const express = require('express'); -const router = express.Router(); const passport = require('passport') +const router = express.Router(); -router.get('/auth/login', passport.authenticate('local', {failureRedirect: '/login'}, +router.get('/auth/login', passport.authenticate('local'), (req, res) => { - res.redirect('/'); - }) + res.redirect('/dashboard'); + } ); router.get('/auth/logout', (req, res) => { req.logout(); - res.redirect('/login'); + res.redirect('/'); }); +router.get('/auth/current_user', (req, res) => { + res.send(req.user); +}); module.exports = router; diff --git a/server/services/socket.js b/server/services/socket.js index d32ac51..1be7385 100644 --- a/server/services/socket.js +++ b/server/services/socket.js @@ -5,7 +5,6 @@ const {pub, sub} = require('../connections/redis_conn') const {iWrite, closeWrite, iQuery} = require('../actions/influx_actions') module.exports = (server) => { - // noinspection JSValidateTypes const io = socket(server) io.on('connection', socket => {