Brought into line with JWT protocol

Resolved #2
This commit is contained in:
2021-03-07 13:53:29 +11:00
parent f919af4248
commit 67a1c744ae
20 changed files with 479 additions and 335 deletions
+2 -9
View File
@@ -2,11 +2,6 @@ const { Op } = require('sequelize');
const { articles, revisions } = require('../database/models');
const route = async (req, res) => {
//check the key
if (req.body.key != process.env.QUERY_KEY) {
return res.status(401).json({ ok: false, error: 'invalid key' });
}
//get the existing record
const record = await articles.findOne({
where: {
@@ -17,7 +12,7 @@ const route = async (req, res) => {
});
if (!record) {
return res.status(500).json({ ok: false, error: 'failed to update non-existing record' });
return res.status(500).send('Failed to update non-existing record');
}
//store the revision
@@ -40,9 +35,7 @@ const route = async (req, res) => {
}
});
return res.status(200).json({
ok: true
});
return res.status(200).end();
};
module.exports = route;