witoldsz / angular-http-auth

MIT License
2.38k stars 417 forks source link

Login cancelled method #34

Closed khasinski closed 10 years ago

khasinski commented 11 years ago

Rejects all the requests and boradcasts event:auth-loginCancelled

Extracted from @stu-salsbury's pull request.

tschofen commented 10 years ago

Just what the doctor ordered. Too bad it hasn't been pulled in yet.

I did noticed though that when all requests are rejected and another interceptor is grabbing the response, the responses are 'undefined'.

theronic commented 10 years ago

I was just writing this method! Thanks. :)

On 19 September 2013 16:57, tschofen notifications@github.com wrote:

Just what the doctor ordered. Too bad it hasn't been pulled in yet.

I did noticed though that when all requests are rejected and another interceptor is grabbing the response, the responses are 'undefined'.

— Reply to this email directly or view it on GitHubhttps://github.com/witoldsz/angular-http-auth/pull/34#issuecomment-24745167 .

Petrus Theron http://petrustheron.com

khasinski commented 10 years ago

@witoldsz care to comment? ;)

stereokai commented 10 years ago

@khasinski would you mind to respond to @tschofen's query? Appreciate that.

witoldsz commented 10 years ago

I did noticed though that when all requests are rejected and another interceptor is grabbing the response, the responses are 'undefined'.

Well, looking at the commit 5727c6c, there is: buffer[i].deferred.reject(); I think this wrong, because there is no reject parameter. Anyone who wants to catch such a reject - will get nothing.

stereokai commented 10 years ago

Why isn't there one? I mean, you are referring to it in retryHttpRequest (within the error callback).

witoldsz commented 10 years ago

Whet isn't there one? You mean there is no parameter in the reject() method? I don't know (notice, the 5727c6c is was not merged). I guess the author of that commit simply forgot about it, looks like he really didn't need it.

stereokai commented 10 years ago

@witoldsz Yes, you said there is no reject parameter. But why do you say there wouldn't be one? I mean, you are pointing to that exact parameter in your own function, retryHttpRequest.

witoldsz commented 10 years ago

I didn't say there wouldn't be one. I just answered the question - pointing to the bug in the referenced commit. Whoever merged this commit can simply fix it.

stereokai commented 10 years ago

I get you now. I was reading your answer out of context.

witoldsz commented 10 years ago

Cherry picked: 17300929fd856d9d17ece2a9612f828248312ed8 Also, cancel action can either abandon or reject the buffer.