I am using Ember: 2.11.0, ember-simple-auth: 1.2.0
I use the ember-simple-auth to authenticate my application via oauth2 to my REST API.
The standard behaviour of ember-simple-auth is to invalidate the users session if the server responds with a 401 status code. I want to handle this different and try to override this:
import DS from 'ember-data';
import DataAdapterMixin from 'ember-simple-auth/mixins/data-adapter-mixin';
export default DS.RESTAdapter.extend(DataAdapterMixin, {
host: 'http://localhost:3000',
authorizer: 'authorizer:oauth2',
/*
* The DataAdapterMixin invalidetes the session automatically if the server
* returns the status 401. We don't want this behaviour, so we override
* the handleResponse method.
*/
handleResponse(status) {
console.log(status);
return this._super(...arguments);
}
});
In my RestAdapter I Use the DataAdapterMixin which triggers the invalidation within the handleResponse method. So I tried to override this method in my adapter. My method is called but after my method finished, the mixins method is called by ember, as you can see here:
The Comments for the Ember superWrapper method state, that it is made to handle calls to methods of the super class and redirect them to it, but somehow it seems to redirect it to the mixin.
I have no idea why this happens or how to prevent this. I'd really appreciate if someone could point me into the right direction.
Aucun commentaire:
Enregistrer un commentaire