有用thinkjs2做后台的吗
怎么配置session和cookie让它保持登录呢?下面这段代码有问题吗?
init(http){
console.log('init base')
var self = this;
super.init(http);
self.assign({
productImgPath:productImgUrl,
globalFid:0
})
//var userInfo = self.session('userInfo');
//console.log(userInfo);
return self.session('userInfo').then(function (userInfo) {
if (isEmpty(userInfo)) {
self.assign({
loginStatus: 0,
userInfo: {}
})
} else {
console.log(userInfo);
self.assign({
loginStatus: 1,
userInfo: userInfo
})
}
return Promise.resolve();
})
};