【问题标题】:Meteor.userId() null inside a packageMeteor.userId() null 包内
【发布时间】:2015-03-27 12:57:21
【问题描述】:

我正在创建一个流星包。这个包在package.json 中使用了account-base

我在服务器端创建了一个这样的方法:

Meteor.methods({
    hide: function(notification_id){
        kahonNotification.hide(notification_id,Meteor.userId())
    }    
});

问题是 Meteor.userId() 一直为空。

这里是配置 package.json 文件:

Package.onUse(function(api) {
  api.versionsFrom('1.0.5');
  api.use(['standard-app-packages'], ['client','server']);
  api.use('accounts-base', 'server');

  // Allows the user of this package to choose their own Bootstrap
  // implementation.
  api.use(['twbs:bootstrap@3.3.1', 'nemo64:bootstrap@3.3.1_1'], 'client', {weak: true});

  api.addFiles(['client/notifications.html','client/notifications.js'],'client');
  api.addFiles(['server/main.js','server/publications.js'],'server');
  api.addFiles('shared/collections.js',['server','client'])

  api.imply(['templating'], 'client');
  api.export('kahonNotification')

});

Package.onTest(function(api) {
  api.use('tinytest');
  api.use('kahon:notificationsefficient');
  api.addFiles('notificationsefficient-tests.js');
});

【问题讨论】:

  • 一旦问题得到回答并且您完成了解决方案提交,问题就变得毫无价值。任何未来的读者都无法从中受益。请在此处发布与您的问题相关的代码。
  • 完成了,谢谢

标签: meteor package account


【解决方案1】:

我没有登录网页。这就是解决方案。

【讨论】:

    猜你喜欢
    • 2014-08-10
    • 1970-01-01
    • 1970-01-01
    • 2012-10-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多