Question

I'm using Restangular and angularjs. I have set up an error handler. In case of a 401 error, I show a login popup. What I want to achieve is rerunning the failed query after the user has successfully logged in. In principle the promise should be still 'alive' and could be resolved with success.

How can I retrieve the query object in the setErrorInterceptor callback which can be recalled? Is this even possible?

Was it helpful?

Solution

I've got the solution. You can intercept the request using the $httpProvider.interceptors following the Session recoverer example under this link:

http://www.webdeveasy.com/interceptors-in-angularjs-and-useful-examples/

This will work perfectly with restangular (it will be transparent from restangular and the rest of your code).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top