Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 28d0b40

Browse files
julianjelfswitoldsz
authored andcommitted
cherry-pick: Added some comments to the manual to explain the addition of the data argument to the loginConfirmed method
Conflicts: src/angular-http-auth.js
1 parent 0bb3081 commit 28d0b40

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@ of every HTTP 401 response is buffered and everytime it happens, the
2121
'event:auth-loginRequired' message is broadcasted from $rootScope.
2222

2323
The 'authService' has only one method: #loginConfirmed().
24-
You are responsible to invoke this method after user logged in.
25-
It will retry all the requests previously failed due to HTTP 401 response.
24+
You are responsible to invoke this method after user logged in. You may optionally pass in
25+
a data argument to the loginConfirmed method which will be passed on to the loginConfirmed
26+
$broadcast. This may be useful, for example if you need to pass through details of the user
27+
that was logged in. The 'authService' will then retry all the requests previously failed due
28+
to HTTP 401 response.
2629

2730
###Typical use case:
2831

src/http-auth-interceptor.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212

1313
.factory('authService', ['$rootScope','httpBuffer', function($rootScope, httpBuffer) {
1414
return {
15+
/**
16+
* call this function to indicate that authentication was successfull and trigger a
17+
* retry of all deferred requests.
18+
* @param data an optional argument to pass on to $broadcast which may be useful for
19+
* example if you need to pass through details of the user that was logged in
20+
*/
1521
loginConfirmed: function(data) {
1622
$rootScope.$broadcast('event:auth-loginConfirmed', data);
1723
httpBuffer.retryAll();

0 commit comments

Comments
 (0)