From b27fd047331156434a1dcf8ea28bc08a68777fbb Mon Sep 17 00:00:00 2001 From: Tessa Thornberry Date: Mon, 22 Jan 2024 16:42:27 -0800 Subject: [PATCH] Update app.js to update req.logout into an asynchronous function --- REST/PhotoFrame/app.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/REST/PhotoFrame/app.js b/REST/PhotoFrame/app.js index fa20f08..b3d201c 100644 --- a/REST/PhotoFrame/app.js +++ b/REST/PhotoFrame/app.js @@ -201,9 +201,11 @@ app.get('/', (req, res) => { // GET request to log out the user. // Destroy the current session and redirect back to the log in screen. app.get('/logout', (req, res) => { - req.logout(); - req.session.destroy(); - res.redirect('/'); + req.logout((err) => { + if (err) {return next(err);} + req.session.destroy(); + res.redirect('/'); + }); }); // Star the OAuth login process for Google.