witoldsz / angular-http-auth

MIT License
2.37k stars 416 forks source link

Breaks angular-loading-bar #107

Closed nimrin closed 9 years ago

nimrin commented 9 years ago

Hello. I am using angular-loading-bar. A 401 should be considered an error response, otherwise loading spinner never stops.
Have you any idea how to handle this issue?

witoldsz commented 9 years ago

Any reason for closing the issue without an explanation?

nimrin commented 9 years ago

I realized that I can use httpBuffer to reject promise when handling 'event:auth-loginRequired' event.

nimrin commented 9 years ago

I tried to call httpBuffer.rejectAll() in 'event:auth-loginRequired' handler, but it takes no effect. Question is still actual.

nimrin commented 9 years ago

My mistake, I used rejectAll() without any parameter.

ronaldheft commented 9 years ago

@nimrin Can you post some sample code for how you fixed this? I'm facing the exact same issue. Are you always calling httpBuffer.rejectAll(), or only under certain scenarios?

ronaldheft commented 9 years ago

@nimrin Figured it out. The solution is actually much simpler than you described. authService.loginCancelled() just needed to be called with a second parameter to provide as the promise rejection.

clong365 commented 9 years ago

@ronaldheft would you give me more detail about the solution. I'm still confused now.