created: function() {
// Always add myself to players' list
this.players.push(this.st.user);
-
- console.log("created");
-ajax("/testtest", "DELETE");
-
// Ask server for current corr games (all but mines)
// ajax(
// "",
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", params.cors.allowedOrigin);
res.header("Access-Control-Allow-Headers",
- "Origin, X-Requested-With, Content-Type, Accept");
- next();
+ "Origin, X-Requested-With, Content-Type, Accept");
+ res.header("Access-Control-Allow-Methods", "GET, POST, OPTIONS, PUT, DELETE");
+ next();
});
}
});
},
- testfunc: function()
- {
- db.serialize(function() {
- db.run("DELETE * FROM TableTest", (err,ret) => {
- console.log(ret);
- });
- });
- },
-
remove: function(id, uid)
{
db.serialize(function() {
const ChallengeModel = require("../models/Challenge");
const UserModel = require("../models/User"); //for name check
-router.delete("/testtest", access.ajax, (req,res) => {
- console.log("passag");
- ChallengeModel.testfunc();
-});
-
router.post("/challenges", access.logged, access.ajax, (req,res) => {
const error = ChallengeModel.checkChallenge(req.body.chall);
if (!!error)
//}
router.delete("/challenges", access.logged, access.ajax, (req,res) => {
- const cid = req.query.cid;
+ const cid = req.query.id;
ChallengeModel.remove(cid, req.userId, err => {
res.json(err || {});
});