문제

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?

도움이 되었습니까?

해결책

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).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top