Added better API errors and stuff

This commit is contained in:
Jori Lallo
2016-09-11 13:38:52 -07:00
parent 9b49b45fe7
commit 53c3d3c318
6 changed files with 34 additions and 37 deletions

View File

@ -0,0 +1,12 @@
export default function apiWrapper(_options) {
return async function apiWrapperMiddleware(ctx, next) {
await next();
const success = ctx.status < 400;
ctx.body = {
...ctx.body,
success,
};
};
}