13 lines
228 B
JavaScript
13 lines
228 B
JavaScript
|
export default function apiWrapper(_options) {
|
||
|
return async function apiWrapperMiddleware(ctx, next) {
|
||
|
await next();
|
||
|
|
||
|
const success = ctx.status < 400;
|
||
|
|
||
|
ctx.body = {
|
||
|
...ctx.body,
|
||
|
success,
|
||
|
};
|
||
|
};
|
||
|
}
|