feat: delete a page

This commit is contained in:
NGPixel
2017-10-09 21:43:43 -04:00
parent fc764b7e4c
commit 516220bdda
11 changed files with 170 additions and 3 deletions

View File

@@ -288,4 +288,29 @@ router.put('/*', (req, res, next) => {
})
})
/**
* Delete document
*/
router.delete('/*', (req, res, next) => {
if (!res.locals.rights.write) {
return res.json({
ok: false,
error: lang.t('errors:forbidden')
})
}
let safePath = entryHelper.parsePath(req.path)
entries.remove(safePath, req.user).then(() => {
res.json({
ok: true
})
}).catch((err) => {
res.json({
ok: false,
error: err.message
})
})
})
module.exports = router