javascript - After redirecting to another state using ui-router success/failure of old requests still launch -



javascript - After redirecting to another state using ui-router success/failure of old requests still launch -

i have web page created using angular ui-router. works well, have 1 problem.

i have 1 view makes lot of separate calls different web servers. if of web servers returns 401 want redirect user login page. servers have sso, user has login once.

sample code requests follows:

request.success(function(data) { //do }).error(function(data, status, headers, config) { errorservice.basicerrorhandler(request.url, data, status, headers, config); });

and basicerrorhandler that(only relevant part):

if (status === 401 || status === 403) { $location.path('/login'); }

now happens:

user redirected /login 1 of request /secured-page user decides not log in, , goes part of page doesn't require authentication, /landing-page one of requests made /secured-page comes now, because 1 of servers slow in delivering result. gets 401, user gets redirected /login page again

in ng-router in case above user wouldn't redirected 1 time again request started in /secured-page, after redirect made. how can avoid behavior in ui-router?

javascript angularjs redirect angular-ui-router

Comments

Popular posts from this blog

c - Compilation of a code: unkown type name string -

java - Bypassing "final local variable defined in an enclosing type" -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -