Skip to content

Add auth interceptor #4

@ant0ha

Description

@ant0ha

Like this:

app.factory('redirectInterceptor', ['$q', '$rootScope', function($q, $rootScope) {
    return function(promise) {
        promise.then(
            function(response) {
                return response;
            },
            function(response) {
                switch(response.status){
                    case 401:
                        $rootScope.logout();
                        break;

                    case 403:
                        $rootScope.logout();
                        break;

                    default:
                        var x;
                }
                return $q.reject(response);
            }
        );
        return promise;
    };
}]);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions