<commit_before>let Templates = {
  home: require('../templates/home.html'),
  getStarted: require('../templates/pages/get_started.html'),
  libs: require('../templates/pages/libs.html'),
  login: require('../templates/pages/login.html')
};

angular.module('updateme', ['ngAnimate', 'ngMaterial', 'ngAria', 'ngRoute', 'angular-loading-bar'])
.config(function($httpProvider, $mdThemingProvider, $compileProvider, $locationProvider, $routeProvider) {
  $httpProvider.defaults.headers.common['X-CSRF-Token'] =
    document.querySelector('meta[name=csrf-token]').content;

  $httpProvider.interceptors.push(function(Me) {
    return {
      request(config) {
        config.headers.Authorization = Me.token;

        if (typeof config.data == 'object') {
          config.data = _.mapKeys(config.data, (_v, k) => _.snakeCase(k));
        }

        return config;
      },
      response(response) {
        if (typeof response.data == 'object') {
          response.data = _.mapKeys(response.data, (_v, k) => _.camelCase(k));
        }

        return response;
      }
    };
  });

  $mdThemingProvider.theme('default')
    .primaryPalette('light-blue', { default: '800' })
    .accentPalette('amber')
    .warnPalette('deep-orange');

  $compileProvider.debugInfoEnabled(false);

  $locationProvider.html5Mode(true);

  $routeProvider
    .when('/', { templateUrl: Templates.home })
    .when('/get-started', { templateUrl: Templates.getStarted })
    .when('/libs/:libType', { templateUrl: Templates.libs })
    .when('/login', { templateUrl: Templates.login })
    .otherwise({ redirectTo: '/' });
})
.factory('Preload', function($cacheFactory) {
  return $cacheFactory('Preload');<commit_msg>redirect to login when error<commit_after>let Templates = {
  home: require('../templates/home.html'),
  getStarted: require('../templates/pages/get_started.html'),
  libs: require('../templates/pages/libs.html'),
  login: require('../templates/pages/login.html')
};

angular.module('updateme', ['ngAnimate', 'ngMaterial', 'ngAria', 'ngRoute', 'angular-loading-bar'])
.config(function($httpProvider, $mdThemingProvider, $compileProvider, $locationProvider, $routeProvider) {
  $httpProvider.defaults.headers.common['X-CSRF-Token'] =
    document.querySelector('meta[name=csrf-token]').content;

  $httpProvider.interceptors.push(function(Me) {
    return {
      request(config) {
        config.headers.Authorization = Me.token;

        if (typeof config.data == 'object') {
          config.data = _.mapKeys(config.data, (_v, k) => _.snakeCase(k));
        }

        return config;
      },
      response(response) {
        if (typeof response.data == 'object') {
          response.data = _.mapKeys(response.data, (_v, k) => _.camelCase(k));
        }

        return response;
      }
    };
  });

  $mdThemingProvider.theme('default')
    .primaryPalette('light-blue', { default: '800' })
    .accentPalette('amber')
    .warnPalette('deep-orange');

  $compileProvider.debugInfoEnabled(false);

  $locationProvider.html5Mode(true);

  $routeProvider
    .when('/', { templateUrl: Templates.home })
    .when('/get-started', { templateUrl: Templates.getStarted })
    .when('/libs/:libType', { templateUrl: Templates.libs })
    .when('/login', { templateUrl: Templates.login })
    .otherwise({ redirectTo: '/' });
})
.run(function($rootScope, $location) {
  $rootScope.$on('$routeChangeError', function() {
    $location.url('/login');
  });
})
.factory('Preload', function($cacheFactory) {
  return $cacheFactory('Preload');
{'fraction_non_alphanumeric': 0.1829510053809119, 'fraction_numerical': 0.0022656471254602095, 'mean_word_length': 3.6473684210526316, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '1858456', 'n_tokens_mistral': 1122, 'n_tokens_neox': 1089, 'n_words': 164}