Added Update Article.

This commit is contained in:
2018-11-27 19:57:21 +11:00
parent 0bf91d2bed
commit b629d8c245
5 changed files with 100 additions and 4 deletions

View File

@ -46,9 +46,9 @@ module.exports = class GetBlogArticle extends APIHandler {
async handle(request) {
//Until we have the server running passport or some other auth service...
if(!request.hasString('password', 128)) return { ok: false, data: ERRORS.password };
if(!request.hasString('password', 128)) return { ok: 401, data: ERRORS.password };
let password = request.getString('password', 128);
if(password !== request.getApp().getConfig().get('admin.password')) return { ok: false, data: ERRORS.password };
if(password !== request.getApp().getConfig().get('admin.password')) return { ok: 401, data: ERRORS.password };
//Everything after this point should be fine to keep.
if(!request.hasString('title', LENGTHS.title)) return { ok: false, data: ERRORS.title };
@ -81,6 +81,6 @@ module.exports = class GetBlogArticle extends APIHandler {
return { ok: 500, data: ERRORS.internal };
}
return { ok: true, data: article };
return { ok: 201, data: article };
}
}