At the moment i'm facing the problem that I need to use the invalidateSession() action from ember-simple-auth (https://github.com/simplabs/ember-simple-auth/) in one of my own controllers.
I normally use it like they do in their examples: {{ action 'invalidateSession' }}
in my handlebars-template. I need to do some preLogout
stuff before I call invalidateSession()
so there needs to be a way - but at the moment I can't figure it out how.
Template:
{{ action 'preLogout' target='view' }}
View:
actions:{
preLogout:function(){
this.get("controller").send("preLogout");
}
}
Controller:
actions:{
preLogout: function(){
var self = this;
//some preLogout things to do
//INVALIDATESESSION - how?
this.transitionToRoute("index");
}
Thanks
The best way to do that is to override the invalidateSession
action and call _super
after you're don't with the necessary actions, e.g.:
// app/routes/applications.js
export default Ember.Route.extend(ApplicationRouteMixin, {
actions: {
invalidateSession: function() {
// do custom stuff…
this._super();
}
}
});