I want to know how can I get the information about the current user in Ember. I'm using ember-simple-auth.
I followed this answer but couldn't access this.get('session.user_email')
.
However, if I do the following in my application.js
route:
export default Ember.Route.extend(ApplicationRouteMixin, {
model() {
console.log(this.get('session'));
}
});
I get the following response:
Here is the link to the repo: https://github.com/ghoshnirmalya/hub-client.
Have you injected the session object inside your route (or controller)
session: Ember.inject.service('session')
or short
session: Ember.inject.service()
Once you do this you should be able to use it inside template
{{#if session.isAuthenticated}}
or inside code:
this.get('session').invalidate();