summaryrefslogtreecommitdiff
path: root/src/server/api/endpoints/auth/accept.ts
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-11-02 13:47:44 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-11-02 13:47:44 +0900
commit174f8022eb5828db3e9af01afcf72fe7526c4c57 (patch)
tree3fab406b94f4244cf5330cf985a8eb518a1e027f /src/server/api/endpoints/auth/accept.ts
parentBetter index (diff)
downloadsharkey-174f8022eb5828db3e9af01afcf72fe7526c4c57.tar.gz
sharkey-174f8022eb5828db3e9af01afcf72fe7526c4c57.tar.bz2
sharkey-174f8022eb5828db3e9af01afcf72fe7526c4c57.zip
Refactor
Diffstat (limited to 'src/server/api/endpoints/auth/accept.ts')
-rw-r--r--src/server/api/endpoints/auth/accept.ts10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/server/api/endpoints/auth/accept.ts b/src/server/api/endpoints/auth/accept.ts
index ed1c2fa390..b7e11bd463 100644
--- a/src/server/api/endpoints/auth/accept.ts
+++ b/src/server/api/endpoints/auth/accept.ts
@@ -4,8 +4,7 @@ import $ from 'cafy';
import App from '../../../../models/app';
import AuthSess from '../../../../models/auth-session';
import AccessToken from '../../../../models/access-token';
-import { ILocalUser } from '../../../../models/user';
-import getParams from '../../get-params';
+import define from '../../define';
export const meta = {
requireCredential: true,
@@ -19,10 +18,7 @@ export const meta = {
}
};
-export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
- const [ps, psErr] = getParams(meta, params);
- if (psErr) return rej(psErr);
-
+export default define(meta, (ps, user) => new Promise(async (res, rej) => {
// Fetch token
const session = await AuthSess
.findOne({ token: ps.token });
@@ -70,4 +66,4 @@ export default (params: any, user: ILocalUser) => new Promise(async (res, rej) =
// Response
res();
-});
+}));