如何流星发布&订阅用户在任何地方登录数据?

时间:2017-04-08 05:29:48

标签: meteor meteor-accounts

愿任何人帮助我吗?我对Meteor有疑问,如何保存用户登录数据可以发布&到处都是? 我创建了一个像Meteor的Users集合这样的集合,并编写了另一个登录函数,但在用户登录后,我无法在任何地方保留他们的数据订阅。 对不起,我不擅长英语! 非常感谢!

3 个答案:

答案 0 :(得分:0)

试试这个:

import { Meteor } from 'meteor/meteor';

Meteor.publish(null, function userData() {
    if (!this.userId) {
        return this.ready();
    }
    return Meteor.users.find(this.userId);
});

答案 1 :(得分:0)

谢谢大家,我找到了答案。似乎Meteor使用HTML5 localStorage enter image description here

答案 2 :(得分:0)

If a user is logged in, you can call Meteor.user() anywhere in your code to access the user object.