<commit_before>"use strict";

  angular.module('medup-app', [
  ])
    .config(($stateProvider, $urlRouterProvider, $httpProvider) => {
      $urlRouterProvider.otherwise('/dashbaord');
      $stateProvider
        .state('dashboard', {
          url: '/dashboard',
          templateUrl: 'app/dashbaord/dashbaord.html',
          controller: 'DashboardCtrl'
        })
        .state('signin', {
          url: '/signin',
          templateUrl: 'app/auth/signin.html',
          controller: 'AuthCtrl'
        })
        .state('signup', {
          url: '/signup',
          templateUrl: 'app/auth/signup.html',
          controller: 'AuthCtrl'
        })
        .state('medications', {
          url: '/medications',
          templateUrl: 'app/auth/medications.html',
          controller: 'MedicationCtrl'
        });
        $httpProvider.interceptors.push('AttachTokens');
      })
      .factory('AttachTokens', attachTokens)
      .run(appRun);

function attachTokens($window) {

  let attach = {
    request: (object) => {

      let jwt = $window.localStorage.getItem('com.pillMeNow');

      if (jwt) {
        object.headers['x-access-token'] = jwt;
      }

      object.headers['Allow-Control-Allow-Origin'] = '*';

      return object;

    }
  };

  return attach;

}

function appRun($rootScope, $state, Auth) {
  $rootScope.on('$stateChangeStart', (evt, toState) => {

    if (toState.name === 'signin') return;

    if (!Auth.isAuth() && toState.name !== 'signup') {
      evt.preventDefault();
      $state.go('signin');
    }
  });
}
<commit_msg>(fix) refactor<commit_after>"use strict";

  import angular from 'angular';
  import uiRouter from 'angular-ui-router';
  import AppComponent from './app.component';

  angular.module('medup-app', [
    'uiRouter'
  ])
    .config(($httpProvider) => {
        $httpProvider.interceptors.push('AttachTokens');
      })
      .factory('AttachTokens', attachTokens)
      .component('medup-app', AppComponent)
      .run(appRun);

function attachTokens($window) {

  let attach = {
    request: (object) => {

      let jwt = $window.localStorage.getItem('com.pillMeNow');

      if (jwt) {
        object.headers['x-access-token'] = jwt;
      }

      object.headers['Allow-Control-Allow-Origin'] = '*';

      return object;

    }
  };

  return attach;

}

function appRun($rootScope, $state, Auth) {
  $rootScope.on('$stateChangeStart', (evt, toState) => {

    if (toState.name === 'signin') return;

    if (!Auth.isAuth() && toState.name !== 'signup') {
      evt.preventDefault();
      $state.go('signin');
    }
  });
}

{'fraction_non_alphanumeric': 0.17128560431100848, 'fraction_numerical': 0.0, 'mean_word_length': 2.4979811574697175, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '3274289', 'n_tokens_mistral': 841, 'n_tokens_neox': 833, 'n_words': 134}