refactor: one-at-a-time spotify api calls, some other modifications and logging reordering

This commit is contained in:
2024-08-05 23:59:09 +05:30
parent 4035e4f070
commit 379ffa22ac
7 changed files with 140 additions and 99 deletions

View File

@@ -18,17 +18,19 @@ const isAuthenticated = (req, res, next) => {
} else {
const delSession = req.session.destroy((err) => {
if (err) {
res.sendStatus(500);
logger.error("Error while destroying session.", { err });
return res.sendStatus(500);
return;
} else {
logger.info("Session invalid, destroyed.", { sessionID: delSession.id });
res.clearCookie(sessionName);
return res.sendStatus(401);
res.sendStatus(401);
logger.debug("Session invalid, destroyed.", { sessionID: delSession.id });
return;
}
});
}
}
module.exports = {
isAuthenticated
isAuthenticated,
}