From 033c73bb01d75e3d139f7a3caa1523857a577bc9 Mon Sep 17 00:00:00 2001 From: Lucas Patenaude Date: Tue, 23 Apr 2024 23:11:21 -0600 Subject: [PATCH] Fix to make page refresh on logout --- ProjectSourceCode/src/index.js | 6 +++++- .../src/resources/js/club-page/refresh-for-favorite.js | 0 2 files changed, 5 insertions(+), 1 deletion(-) delete mode 100644 ProjectSourceCode/src/resources/js/club-page/refresh-for-favorite.js diff --git a/ProjectSourceCode/src/index.js b/ProjectSourceCode/src/index.js index e04f54a..c70bd91 100644 --- a/ProjectSourceCode/src/index.js +++ b/ProjectSourceCode/src/index.js @@ -246,17 +246,21 @@ app.get('/home', (req, res) => { const loggedIn = req.session.user ? true : false; res.render('pages/home'); }); + app.get('/logout', (req, res) => { req.session.destroy(err => { if (err) { console.error('Error destroying session:', err); res.status(500).send('Internal Server Error'); } else { - res.render('pages/home', { message: 'Logged out Successfully' }); + // Redirect to the same page after destroying the session + res.redirect('/'); // You can change '/' to the desired page if it's not the home page } }); }); + + /************************ League Page Routes *************************/ diff --git a/ProjectSourceCode/src/resources/js/club-page/refresh-for-favorite.js b/ProjectSourceCode/src/resources/js/club-page/refresh-for-favorite.js deleted file mode 100644 index e69de29..0000000