Meteor用户配置文件未发布

时间:2014-04-21 11:30:29

标签: meteor

根据meteor docs,用户个人资料信息始终发布:

http://docs.meteor.com/#meteor_user

但是,我的Chrome控制台中的Meteor.user.profileundefined,但当我在mongodb服务器端cli中检入时,它包含正确的用户数据。

这是我的模板代码:

<head>
  <title>test-login</title>
</head>
<body>
  {{> userInfo}}
</body>
<template name="userInfo">
  {{#if currentUser}}
    {{> userLoggedIn}}
  {{else}}
    {{> userLoggedOut}}
  {{/if}}
</template>
<template name="userLoggedIn">
  {{#if loggingIn}}
    <a>Logging In</a>
  {{else}}
    <a>{{curentUser.profile.name}}</a>
  {{/if}}
</template>
<template name="userLoggedOut">
  <a id="login">Login with Github</a>
</template>

我的客户端js:

Template.userLoggedOut.events({
  "click #login": function (e, tmpl) {
    Meteor.loginWithGithub({
      requestPermissions: ['user', 'public_repo']
    });
  }
});

Template.userLoggedIn.events({
  "click #logout": function (e, tmpl) {
    Meteor.logout();
  }
});

我的服务器端js:

ServiceConfiguration.configurations.remove({
  service: 'github'
});

ServiceConfiguration.configurations.insert({
  service: 'github',
  clientId: 'xxxxxx',
  secret: 'yyyyyyyyyyy'
});

我正在使用最新的流星0.8.0,只包含以下软件包:

standard-app-packages
autopublish
insecure
accounts-github
service-configuration

1 个答案:

答案 0 :(得分:1)

应该是Meteor.user().profile,而不是Meteor.user.profile

相关问题