What is the correct way to integrate the user session into components?
For instance my comment-item component is going to vary with the session (informations displayed and possible actions).
How should I handle the fact that the session is asynchronous, and possibly loaded after the component?
For example, in my component I had to do:
this.get('session.sessionUser').then(function(value) {
console.log(this.get('session.sessionUser'));
In order to get the session properly. But this is not always possible (in computed properties etc.).
What is the correct way?
Aucun commentaire:
Enregistrer un commentaire