خرید بک لینک

Vote count: 0

Using ember-simple-auth I set up a session and set the currentUser key equal to the user object retued from the server:

setCurrentUser: function () {
    if (this.get('isAuthenticated')) {
        const accountId = this.get('session.content.authenticated.user_id');
        this.get('store').findRecord('user', accountId).then(user => {
            this.set('currentUser', user);
        });
    }
}.observes('isAuthenticated')

Problem is when I am trying to access the 'currentUser' key from a route for a data relation:

user: Ember.computed(function(){
    console.log(this.get('session'));
    //retu `${this.get('session.currentUser')}`;
  }),

In the console I see (in addition to a bunch of other stuff):

 currentUser: Class 

but if I try to log 'session.currentUser' I am seeing undefined.

What can I do to access the user ID from this route? Having a lot of trouble with this! Thanks in advance :D

asked 55 secs ago

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 11 فروردين 1395 ساعت: 5:45

صفحه بندی