Skip to content

Commit

Permalink
Merge pull request #339 from dflourusso/master
Browse files Browse the repository at this point in the history
Not destroy token if no connection
  • Loading branch information
booleanbetrayal authored Dec 21, 2016
2 parents fb7565f + afadb30 commit d5d3d61
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
11 changes: 8 additions & 3 deletions dist/ng-token-auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ angular.module('ng-token-auth', ['ipCookie']).provider('$auth', function() {
_this.rejectDfd({
reason: 'unauthorized',
errors: resp.data != null ? resp.data.errors : ['Unspecified error']
});
}, resp.status > 0);
return $q.reject(resp);
};
})(this));
Expand Down Expand Up @@ -698,8 +698,13 @@ angular.module('ng-token-auth', ['ipCookie']).provider('$auth', function() {
initDfd: function() {
return this.dfd = $q.defer();
},
rejectDfd: function(reason) {
this.invalidateTokens();
rejectDfd: function(reason, invalidateTokens) {
if (invalidateTokens == null) {
invalidateTokens = true;
}
if (invalidateTokens === true) {
this.invalidateTokens();
}
if (this.dfd != null) {
this.dfd.reject(reason);
return $timeout(((function(_this) {
Expand Down
Loading

0 comments on commit d5d3d61

Please sign in to comment.