send/server/routes/delete.js
2018-02-05 16:37:06 -08:00

21 lines
404 B
JavaScript

const storage = require('../storage');
module.exports = async function(req, res) {
const id = req.params.id;
const ownerToken = req.body.owner_token || req.body.delete_token;
if (!ownerToken) {
res.sendStatus(404);
return;
}
try {
const err = await storage.delete(id, ownerToken);
if (!err) {
res.sendStatus(200);
}
} catch (e) {
res.sendStatus(404);
}
};