1

我正在使用 CollectionFS 和 GridFS 来上传图像:

Pictures.insert(e.target.files[0], function(err, res) {
  if (err) return console.log(err);
  this.setState({editing: false});
});

但是上传时出现错误:

Exception in delivering result of invoking '/cfs.pictures.filerecord/insert': 
TypeError: Accounts._storedLoginToken is not a function

我试过Accounts._storedLoginToken()在 Meteor shell 中调用,它给出了同样的错误。

错误发生在 Meteor 代码中:

var authToken = '';                                                                                        
if (typeof Accounts !== "undefined") {                                                                     
var authObject = {                                                                                       
  authToken: Accounts._storedLoginToken() || '',                                                         
};                                                                                                    
// Set the authToken                                                                                    
var authString = JSON.stringify(authObject);
  authToken = FS.Utility.btoa(authString);
}  

任何帮助将非常感激。

4

1 回答 1

1

您是否将帐户库添加到您的项目中?在您添加某个 pkg(例如 account-base)之前,Accounts对象没有该方法。_storedLoginToken

于 2018-05-17T19:09:17.813 回答