wip
This commit is contained in:
parent
61f21594a9
commit
22d2f2051c
10 changed files with 40 additions and 26 deletions
|
|
@ -25,11 +25,21 @@ export default async (endpoint: Endpoint, ctx: Koa.Context) => {
|
|||
|
||||
// Authentication
|
||||
try {
|
||||
[user, app] = await authenticate(ctx.body['i']);
|
||||
[user, app] = await authenticate(ctx.request.body['i']);
|
||||
} catch (e) {
|
||||
return reply(403, 'AUTHENTICATION_FAILED');
|
||||
reply(403, 'AUTHENTICATION_FAILED');
|
||||
return;
|
||||
}
|
||||
|
||||
let res;
|
||||
|
||||
// API invoking
|
||||
call(endpoint, user, app, ctx.body, ctx.req).then(reply).catch(e => reply(400, e));
|
||||
try {
|
||||
res = await call(endpoint, user, app, ctx.request.body, ctx.req);
|
||||
} catch (e) {
|
||||
reply(400, e);
|
||||
return;
|
||||
}
|
||||
|
||||
reply(res);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue