我使用 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
我尝试在 Meteor shell 中调用 Accounts._storedLoginToken()
,但它给出了相同的错误。
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);
}
任何帮助将不胜感激。
最佳答案
您添加了accounts-base吗?到你的项目? Accounts
对象没有 _storedLoginToken
方法,直到您添加某个 pkg(例如 account-base)。
关于javascript - Meteor:Accounts._storedLoginToken 不是函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36184011/