<commit_before>/**
 * Date: 1/9/15
 * Author: <NAME>
 */

(function () {
  'use strict';

angular
    .module('crowdsource.interceptor', [])
    .factory('AuthHttpResponseInterceptor', AuthHttpResponseInterceptor);

AuthHttpResponseInterceptor.$inject = ['$location', '$log', '$injector', '$q'];

function AuthHttpResponseInterceptor($location, $log, $injector, $q) {
        return {
            responseError: function (rejection) {
                if (rejection.status === 403) {

                    if (rejection.hasOwnProperty('data')
                        && rejection.data.hasOwnProperty('detail')
                        && (rejection.data.detail.indexOf("Authentication credentials were not provided") != -1)
                        ) {
                        var $http = $injector.get('$http');
                        var Authentication = $injector.get('Authentication');

                          if (!Authentication.isAuthenticated()) {
                            $location.path('/login');
                          }else{
                              deferred.resolve(data);
                          }
                    }
                }

                return $q.reject(rejection);
            }
        }
    }
<commit_msg>Remove deferred as not needed<commit_after>/**
 * Date: 1/9/15
 * Author: <NAME>
 */

(function () {
  'use strict';

angular
    .module('crowdsource.interceptor', [])
    .factory('AuthHttpResponseInterceptor', AuthHttpResponseInterceptor);

AuthHttpResponseInterceptor.$inject = ['$location', '$log', '$injector', '$q'];

function AuthHttpResponseInterceptor($location, $log, $injector, $q) {
        return {
            responseError: function (rejection) {
                if (rejection.status === 403) {

                    if (rejection.hasOwnProperty('data')
                        && rejection.data.hasOwnProperty('detail')
                        && (rejection.data.detail.indexOf("Authentication credentials were not provided") != -1)
                        ) {
                        var $http = $injector.get('$http');
                        var Authentication = $injector.get('Authentication');

                          if (!Authentication.isAuthenticated()) {
                            $location.path('/login');
                          }
                    }
                }

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

{'fraction_non_alphanumeric': 0.13070283600493218, 'fraction_numerical': 0.006576243321002877, 'mean_word_length': 1.5301455301455302, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2348302', 'n_tokens_mistral': 622, 'n_tokens_neox': 584, 'n_words': 104}