From 99da4f9839e49c339624e16390a487ed102e96c2 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 16 Oct 2018 08:54:36 +0900 Subject: Add some tests and some fixes --- src/server/api/endpoints/i/update.ts | 2 +- src/server/api/private/signup.ts | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/api/endpoints/i/update.ts b/src/server/api/endpoints/i/update.ts index 77825a4aaa..7b8431f0ee 100644 --- a/src/server/api/endpoints/i/update.ts +++ b/src/server/api/endpoints/i/update.ts @@ -101,7 +101,7 @@ export const meta = { export default async (params: any, user: ILocalUser, app: IApp) => new Promise(async (res, rej) => { const [ps, psErr] = getParams(meta, params); - if (psErr) throw psErr; + if (psErr) return rej(psErr); const isSecure = user != null && app == null; diff --git a/src/server/api/private/signup.ts b/src/server/api/private/signup.ts index e3e8f044b5..13ca16eb9f 100644 --- a/src/server/api/private/signup.ts +++ b/src/server/api/private/signup.ts @@ -132,6 +132,12 @@ export default async (ctx: Koa.Context) => { updateUserStats(account, true); - // Response - ctx.body = await pack(account); + const res = await pack(account, account, { + detail: true, + includeSecrets: true + }); + + res.token = secret; + + ctx.body = res; }; -- cgit v1.2.3-freya