Fix logout redirect
This commit is contained in:
parent
ae143745ab
commit
bff4e83730
@ -289,13 +289,18 @@ api.post("/match/:matchId/setWinner", async (req, res) => {
|
|||||||
res.json({"status": "error", "data": "matchId must be a number"});
|
res.json({"status": "error", "data": "matchId must be a number"});
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (winnerId == undefined || isNaN(winnerId)) {
|
if (winnerId == undefined || (isNaN(winnerId) && winnerId != "null")) {
|
||||||
res.json({"status": "error", "data": "winnerId must be a number"});
|
res.json({"status": "error", "data": "winnerId must be a number"});
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
matchId = parseInt(matchId);
|
matchId = parseInt(matchId);
|
||||||
|
if (winnerId == "null") {
|
||||||
|
winnerId = null;
|
||||||
|
} else {
|
||||||
winnerId = parseInt(winnerId);
|
winnerId = parseInt(winnerId);
|
||||||
|
}
|
||||||
tmdb.setMatchWinner(matchId, winnerId)
|
tmdb.setMatchWinner(matchId, winnerId)
|
||||||
.then(match => res.send({"status": "OK", "data": match}))
|
.then(match => res.send({"status": "OK", "data": match}))
|
||||||
.catch(err => res.send({"status": "error", "data": err}));
|
.catch(err => res.send({"status": "error", "data": err}));
|
||||||
@ -484,11 +489,6 @@ function isSessionManager(session) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
api.get("/logout", (req, res) => {
|
|
||||||
req.session.destroy();
|
|
||||||
res.redirect(process.env.AUTH_SUCCESS_REDIRECT);
|
|
||||||
});
|
|
||||||
|
|
||||||
api.get("/users/getSavedUser", (req, res) => {
|
api.get("/users/getSavedUser", (req, res) => {
|
||||||
if (!req.session.user) {
|
if (!req.session.user) {
|
||||||
res.json({"status": "error", "data": "No user logged in"});
|
res.json({"status": "error", "data": "No user logged in"});
|
||||||
@ -565,6 +565,11 @@ api.delete("/users/:asuraId", async (req, res) => {
|
|||||||
.catch(err => res.json({"status": "error", "data": err}));
|
.catch(err => res.json({"status": "error", "data": err}));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
api.get("/users/logout", (req, res) => {
|
||||||
|
req.session.destroy();
|
||||||
|
res.redirect(process.env.AUTH_SUCCESS_REDIRECT);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// Debugging functions, disabled on purpouse
|
// Debugging functions, disabled on purpouse
|
||||||
// api.get("/users/getSessionUser", (req, res) => {
|
// api.get("/users/getSessionUser", (req, res) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user