projects
/
vchess.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
36093eb
)
Remove test instructions, fix CORS for DELETE method
author
Benjamin Auder
<benjamin.auder@somewhere>
Tue, 12 Mar 2019 16:36:02 +0000
(17:36 +0100)
committer
Benjamin Auder
<benjamin.auder@somewhere>
Tue, 12 Mar 2019 16:36:02 +0000
(17:36 +0100)
client/src/views/Hall.vue
patch
|
blob
|
blame
|
history
server/app.js
patch
|
blob
|
blame
|
history
server/models/Challenge.js
patch
|
blob
|
blame
|
history
server/routes/challenges.js
patch
|
blob
|
blame
|
history
diff --git
a/client/src/views/Hall.vue
b/client/src/views/Hall.vue
index
1d842d5
..
19f2e77
100644
(file)
--- a/
client/src/views/Hall.vue
+++ b/
client/src/views/Hall.vue
@@
-125,10
+125,6
@@
export default {
created: function() {
// Always add myself to players' list
this.players.push(this.st.user);
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(
// "",
// Ask server for current corr games (all but mines)
// ajax(
// "",
diff --git
a/server/app.js
b/server/app.js
index
d4aef28
..
13cf1db
100644
(file)
--- a/
server/app.js
+++ b/
server/app.js
@@
-36,8
+36,9
@@
if (params.cors.enable)
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", params.cors.allowedOrigin);
res.header("Access-Control-Allow-Headers",
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();
});
}
});
}
diff --git
a/server/models/Challenge.js
b/server/models/Challenge.js
index
8adf3ca
..
de2818b
100644
(file)
--- a/
server/models/Challenge.js
+++ b/
server/models/Challenge.js
@@
-126,15
+126,6
@@
const ChallengeModel =
});
},
});
},
- testfunc: function()
- {
- db.serialize(function() {
- db.run("DELETE * FROM TableTest", (err,ret) => {
- console.log(ret);
- });
- });
- },
-
remove: function(id, uid)
{
db.serialize(function() {
remove: function(id, uid)
{
db.serialize(function() {
diff --git
a/server/routes/challenges.js
b/server/routes/challenges.js
index
99f055f
..
40c50ec
100644
(file)
--- a/
server/routes/challenges.js
+++ b/
server/routes/challenges.js
@@
-5,11
+5,6
@@
const access = require("../utils/access");
const ChallengeModel = require("../models/Challenge");
const UserModel = require("../models/User"); //for name check
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.post("/challenges", access.logged, access.ajax, (req,res) => {
const error = ChallengeModel.checkChallenge(req.body.chall);
if (!!error)
@@
-70,7
+65,7
@@
router.post("/challenges", access.logged, access.ajax, (req,res) => {
//}
router.delete("/challenges", access.logged, access.ajax, (req,res) => {
//}
router.delete("/challenges", access.logged, access.ajax, (req,res) => {
- const cid = req.query.
c
id;
+ const cid = req.query.id;
ChallengeModel.remove(cid, req.userId, err => {
res.json(err || {});
});
ChallengeModel.remove(cid, req.userId, err => {
res.json(err || {});
});