if (!!error)
return alert(error);
const ctype = this.classifyObject(this.newchallenge);
+ if (ctype == "corr" && this.st.user.id <= 0)
+ return alert("Please log in to play correspondance games");
// NOTE: "from" information is not required here
let chall = Object.assign({}, this.newchallenge);
const finishAddChallenge = (cid,warnDisconnected) => {
db.run(query, (err,gameIds) => {
if (!!err)
return cb(err);
+ gameIds = gameIds || []; //might be empty
let gameArray = [];
gameIds.forEach(gidRow => {
GameModel.getOne(gidRow["gid"], (err2,game) => {
const userId = req.query["uid"];
const excluded = !!req.query["excluded"];
GameModel.getByUser(userId, excluded, (err,games) => {
- access.checkRequest(res, err, games, "Games not found", () => {
- res.json({games: games});
- });
+ if (!!err)
+ return res.json({errmsg: err.errmsg || err.toString()});
+ res.json({games: games});
});
}
});