本文整理匯總了TypeScript中meteor/meteor.Meteor.user方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Meteor.user方法的具體用法?TypeScript Meteor.user怎麽用?TypeScript Meteor.user使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類meteor/meteor.Meteor
的用法示例。
在下文中一共展示了Meteor.user方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: verifyUser
function verifyUser(){
let user = Meteor.user();
return !!user;
}
示例2: function
insert: function() {
let user = Meteor.user();
return !!user;
},
示例3: loggedIn
// Check if user is logged in
function loggedIn() {
return !!Meteor.user();
}
示例4: addGroupProject
});
});
}
}
for (let k in ret) {
if (!ret[k].email) continue;
retArr.push(ret[k]);
}
return retArr;
},
addGroupProject(projectId: string, groupName: string) {
check(groupName, String);
check(projectId, String);
let user = Meteor.user();
if (!user) {
throw new Meteor.Error('403', 'not-authorized');
}
let project = Projects.findOne({ owner: user._id, _id: projectId });
if (!project) {
throw new Meteor.Error('403', 'not-authorized');
}
if (!project.groups) {
project.groups = [];
}
// check if exists
let exists = false;
project.groups.forEach((group) => {
if (group.name === groupName) {
exists = true;
示例5: canActivate
canActivate() {
if (!Meteor.user()) {
this.router.navigate(['/login']);
}
return !!Meteor.user();
}
示例6:
update: () => {
let user = Meteor.user();
return !!user;
},
示例7: function
let loggedIn = function(){return !!Meteor.user();}