Skip to content

Commit

Permalink
Only invalidate session if authenticated
Browse files Browse the repository at this point in the history
  • Loading branch information
wireframe committed Oct 16, 2015
1 parent 897779e commit fe3ffd8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions addon/mixins/data-adapter-mixin.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Ember from 'ember';
import DS from 'ember-data';

const { service } = Ember.inject;

Expand Down Expand Up @@ -94,8 +95,10 @@ export default Ember.Mixin.create({
*/
handleResponse(status) {
if (status === 401) {
this.get('session').invalidate();
return true;
if (this.get('session.isAuthenticated')) {
this.get('session').invalidate();
}
return new DS.InvalidError(['Session is not authenticated']);
} else {
return this._super(...arguments);
}
Expand Down

0 comments on commit fe3ffd8

Please sign in to comment.