包内的Meteor.userId()null

时间:2015-03-27 12:57:22

标签: meteor package account

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

我在服务器端创建了一个方法,如下所示:

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');
});

1 个答案:

答案 0 :(得分:0)

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