Refactor
This commit is contained in:
parent
ddc3c5ba68
commit
174f8022eb
131 changed files with 512 additions and 917 deletions
|
|
@ -1,7 +1,6 @@
|
|||
import $ from 'cafy';
|
||||
import AuthSess, { pack } from '../../../../../models/auth-session';
|
||||
import { ILocalUser } from '../../../../../models/user';
|
||||
import getParams from '../../../get-params';
|
||||
import define from '../../../define';
|
||||
|
||||
export const meta = {
|
||||
requireCredential: false,
|
||||
|
|
@ -13,10 +12,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) => {
|
||||
// Lookup session
|
||||
const session = await AuthSess.findOne({
|
||||
token: ps.token
|
||||
|
|
@ -28,4 +24,4 @@ export default (params: any, user: ILocalUser) => new Promise(async (res, rej) =
|
|||
|
||||
// Response
|
||||
res(await pack(session, user));
|
||||
});
|
||||
}));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue