Basically, you have to instead create an interceptor that has method
responseError on it, instead of error. So something like:

angular.module('app').config(function($q, $httpProvider) {
 $httpProvider.interceptors.push(function($rootScope) {
    return {
      responseError: function(rejection) {
        if (rejection.status === 403) {
          $rootScope.softlogout();
        } else {
          return $q.reject(rejection);
        }
      }
    };
  });
});




On Fri Nov 21 2014 at 1:59:30 AM Michael Mayer <[email protected]>
wrote:

> Hello dear community!
>
> i need some help with one of my response interceptors. I don't really get
> the code myself (not my project) and would need some help in generating a
> equivalent angular 1.3 'thingy'.
>
> Here is my code snippet:
>
>
>     .config(['$httpProvider', function ($httpProvider, $rootScope) {
>         var interceptor = ['$q', '$location', '$rootScope', function ($q,
> $location, scope) {
>             function success(response) {
>                 return response;
>             }
>
>             function error(response) {
>                 if (response.status === 403) {
>                     scope.session.softlogout();
>                 }
>                 return $q.reject(response);
>             }
>
>             return function (promise) {
>                 return promise.then(success, error);
>             }
>
>         }];
>
>         $httpProvider.responseInterceptors.push(interceptor);
>
>
> Do you guys know how to get the same code running in angularjs 1.3?
>
> Best regards!
>
> Michael
>
> --
> You received this message because you are subscribed to the Google Groups
> "AngularJS" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to