Skip to content

Commit fcc39c6

Browse files
committed
Merge pull request #127 from migajek/patch-1
loginConfirmed: updater returns false to ignore request
2 parents 50c1fe7 + 472e6a2 commit fcc39c6

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,10 @@ The `loginConfirmed` method supports the injection of an Updater function that w
8686

8787
The initial failed request will now be retried, all queued http requests will be recalculated using the Updater-Function.
8888

89+
It is also possible to stop specific request from being retried, by returning ``false`` from the Updater-Function:
90+
91+
authService.loginConfirmed('success', function(config){
92+
if (shouldSkipRetryOnSuccess(config))
93+
return false;
94+
return config;
95+
})

src/http-auth-interceptor.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@
122122
*/
123123
retryAll: function(updater) {
124124
for (var i = 0; i < buffer.length; ++i) {
125-
retryHttpRequest(updater(buffer[i].config), buffer[i].deferred);
125+
var _cfg = updater(buffer[i].config);
126+
if (_cfg !== false)
127+
retryHttpRequest(_cfg, buffer[i].deferred);
126128
}
127129
buffer = [];
128130
}

0 commit comments

Comments
 (0)