【问题标题】:Getting currentUser id from server从服务器获取 currentUser id
【发布时间】:2016-11-14 22:07:39
【问题描述】:

我正在尝试在使用meteor-uploads 上传文件后更新用户“photoPath”字段。 我收到此错误:

错误:Meteor 代码必须始终在 Fiber 中运行。尝试包装 传递给非 Meteor 库的回调 Meteor.bindEnvironment.

服务器/init.js

validateFile: function(file, req) {
    Meteor.users.update( { _id: Meteor.userId() }, {$set: {"profile.photoPath": req.path}});

    return null; 
}

【问题讨论】:

标签: meteor meteor-blaze meteor-accounts


【解决方案1】:

您应该使用
this.userId 从服务器端访问用户

【讨论】:

    猜你喜欢
    • 2011-07-20
    • 1970-01-01
    • 2022-12-05
    • 2020-06-14
    • 1970-01-01
    • 1970-01-01
    • 2011-06-30
    • 2019-03-21
    • 2020-08-24
    相关资源
    最近更新 更多