<commit_before>/*global
    angular
 */

(function (angular) {
    "use strict";

    angular.module("dailyPlanner", [
            "controllers",
            "services",
            "directives",
            "filters"
        ])

        .factory("httpInterceptor", [
            "$q",
            "$window",
            "$log",

            function ($q, $window, $log) {
                return function (promise) {
                    return promise.then(
                        function (response) {
                            // success
                            var responseHeader;

                            responseHeader = response.headers();

                            if (response.data && responseHeader["content-type"].indexOf("text/html") !== -1) {
                                if (response.data.indexOf('<meta name="unauthorized" content="true">') !== -1) {
                                    $log.error("unauthorized");
                                    $window.location.reload();
                                    return $q.reject(response);
                                }
                            }

                            return response;
                        },
                        function (response) {
                            // error
                            return $q.reject(response);
                        }
                    );
                };
            }

        ])

        .config([
            "$httpProvider",

            function ($httpProvider) {
                $httpProvider.responseInterceptors.push("httpInterceptor");
            }
        ]);
}(angular));<commit_msg>httpInterceptor ersetzt (alte Implementierung war DEPRECATED)<commit_after>/*global
    angular
 */

(function (angular) {
    "use strict";

    angular.module("dailyPlanner", [
        "controllers",
        "services",
        "directives",
        "filters"
    ])

        .factory("httpInterceptor", [
            "$q",
            "$window",
            "$log",

            function ($q, $window, $log) {
                return {
                    "response": function (response) {
                        // do something on success
                        var responseHeader;
                        responseHeader = response.headers();

                        if (response.data && responseHeader["content-type"].indexOf("text/html") !== -1) {
                            if (response.data.indexOf('<meta name="unauthorized" content="true">') !== -1) {
                                $log.error("unauthorized");
                                $window.location.reload();
                                return $q.reject(response);
                            }
                        }
                        return response || $q.when(response);
                    },

                    "responseError": function (rejection) {
                        // do something on error
                        return $q.reject(rejection);
                    }
                };
            }
        ])

        .config([
            "$httpProvider",

            function ($httpProvider) {
                $httpProvider.interceptors.push("httpInterceptor");
            }
        ]);
}(angular));
{'fraction_non_alphanumeric': 0.11638591117917305, 'fraction_numerical': 0.001225114854517611, 'mean_word_length': 0.9498507462686567, 'pattern_counts': {'":': 2, '<': 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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2566123', 'n_tokens_mistral': 734, 'n_tokens_neox': 691, 'n_words': 123}