Skip to content

Commit a6e1462

Browse files
authored
Merge pull request #2473 from rajatmohan22/logoutGlitchFix
Fix: Logout Glitch
2 parents 0497096 + bcaa0bf commit a6e1462

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

server/controllers/session.controller.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,17 @@ export function getSession(req, res) {
3131
}
3232

3333
export function destroySession(req, res, next) {
34-
req.logout((err) => {
34+
req.session.destroy((err) => {
3535
if (err) {
3636
next(err);
3737
return;
3838
}
39-
res.json({ success: true });
39+
req.logout((error) => {
40+
if (error) {
41+
next(error);
42+
return;
43+
}
44+
res.json({ success: true });
45+
});
4046
});
4147
}

0 commit comments

Comments
 (0)