ember-simple-auth

Ember Simple Auth - injecting current user into every route

天涯浪子 提交于 2019-11-27 01:29:58
问题 I am building a site using Ember Simple Auth. I followed these instructions to try and add the current user object to the session and it worked, using this slightly adapted code: import Ember from 'ember'; import Session from 'simple-auth/session'; export default { name: "current-user", before: "simple-auth", initialize: function(container) { Session.reopen({ setCurrentUser: function() { var accessToken = this.get('secure.token'); var _this = this; if (!Ember.isEmpty(accessToken)) { return