let data = {
"user":"12",
"questionList":questionList
};
await ctx.render("index",data);
import {UserClient} from "../manager/user/UserClient";
export const signInStatusMiddleware = async (ctx:any,next:any)=>{
console.log("signInStatusMiddleware")
let accessToken = ctx.cookies.get("ACCESS-TOKEN");
if(accessToken){
let userClient :UserClient = new UserClient;
let user = await userClient.getUserByToken(accessToken);
}
await next();
}
return function views(ctx, next) {
if (ctx.render) return next()
ctx.render = function(relPath, locals = {}) {
return getPaths(path, relPath, extension).then(paths => {
const suffix = paths.ext
const state = Object.assign(locals, options, ctx.state || {})
// deep copy partials
state.partials = Object.assign({}, options.partials || {})
debug('render `%s` with %j', paths.rel, state)
ctx.type = 'text/html'
if (isHtml(suffix) && !map) {
return send(ctx, paths.rel, {
root: path
})
} else {
const engineName = map && map[suffix] ? map[suffix] : suffix
const render = engineSource[engineName]
if (!engineName || !render)
return Promise.reject(
new Error(`Engine not found for the ".${suffix}" file extension`)
)
return render(resolve(path, paths.rel), state).then(html => {
ctx.body = html
})
}
})
}
return next()
}
const state = Object.assign(locals, options, ctx.state || {})
export const signInStatusMiddleware = async (ctx:any,next:any)=>{
console.log("signInStatusMiddleware")
let accessToken = ctx.cookies.get("ACCESS-TOKEN");
if(accessToken){
let userClient :UserClient = new UserClient;
let user = await userClient.getUserByToken(accessToken);
ctx.state = Object.assign(ctx.state,{"user":user});
}
await next();
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有