Kaynağa Gözat

Fix bug where session was not being destroyed

sbkwgh 8 yıl önce
ebeveyn
işleme
cc8aae5a46
1 değiştirilmiş dosya ile 5 ekleme ve 5 silme
  1. 5 5
      routes/user.js

+ 5 - 5
routes/user.js

@@ -249,11 +249,11 @@ router.post('/:username/login', async (req, res) => {
 })
 
 router.post('/:username/logout', async (req, res) => {
-	req.session = null
-	res.clearCookie('username')
-	
-	res.json({
-		success: true
+	req.session.destroy(() => {
+		res.clearCookie('username')
+		res.json({
+			success: true
+		})
 	})
 })