UNPKG

generator-wxnode-boilerplate

Version:

Yeoman generator for wxnode boilerplate

24 lines (22 loc) 582 B
import {ICustomRouterContext} from '../@types/types'; import {isLogin} from '../service/login'; export default async function loginMid(ctx: ICustomRouterContext, next) { try { if (isLogin(ctx)) { return next(); } else { ctx.body = { success: false, code: -1001, msg: '请先登录', }; } } catch (error) { // 校验登录态失败 ctx.body = { success: false, code: -1001, msg: '请先登录', }; } }