Added logout
This commit is contained in:
@@ -246,6 +246,16 @@ 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' });
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/************************
|
||||
League Page Routes
|
||||
|
||||
@@ -7,5 +7,6 @@
|
||||
<img id="teamlogo" src="{{this.teamlogo}}" alt="teamlogo">
|
||||
<span>{{this.teamname}}</span> <br>
|
||||
{{/each}}
|
||||
<a class="nav-link" href = "/logout">Logout</a>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user