In my response always use the Error.

app.factory('authInterceptor', function ($rootScope, session, $q,
REQUEST_EVENTS) {
  return {
    request: function (config) {

      if (session.current.isAuthenticated) {
        config.headers['X-Auth-Token'] =
session.current.user.nomeLogin + "_" + session.current.accessToken;
      }

      return config;
    },

    response: function (response) {
      if (response.data.status != undefined && response.data.status != 200) {
        response.status = response.data.status;
        response.data = response.data.entity;
        return $q.reject(response);
      }
      return response;
    },

    responseError: function (response) {

      if (response.status == 401) {
        $rootScope.$broadcast(REQUEST_EVENTS.notAuthenticated);
      }

      return $q.reject(response);
    }
  };
});


2015-12-09 12:31 GMT-03:00 Max <[email protected]>:

> I'm using this example:
>>
>
> https://auth0.com/blog/2014/01/07/angularjs-authentication-with-cookies-vs-token/
>
>
> --
> 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.
>



-- 
Att
Armando Couto
CSM - LKU
www.armandocouto.com.br

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