<commit_before>'use strict';

module.exports = ['$stateProvider', '$urlRouterProvider', routerConfig];

function routerConfig($stateProvider, $urlRouterProvider) {
  $urlRouterProvider.when('', '/join#signup');
  $urlRouterProvider.when('/', '/join#signup');
  $urlRouterProvider.when('/signup', '/join#signup');
  $urlRouterProvider.when('/login', '/join#login');

  let states = [
    {
      name: 'home',
      url: '/home',
      template: require('../view/home/home.html'),
      controller: 'HomeController',
      controllerAs: 'homeCtrl',
      resolve: {
        isAuthorized
      }
    },
    {
      name: 'landing',
      url: '/join',
      template: require('../view/landing/landing.html'),
      controller: 'LandingController',
      controllerAs: 'landingCtrl'
    },
    {
      name: 'message',
      url: '/message',
      template: require('../view/message/message.html'),
      controller: 'MessageController',
      controllerAs: 'messageCtrl',
      resolve: {
        isAuthorized
      }
    },
    {
      name: 'way',
      url: '/way',
      template: require('../view/way/way.html'),
      controller: 'WayController',
      controllerAs: 'wayCtrl',
      resolve: {
        wayService: 'wayService',
        ways: function(wayService) {
          if (wayService.waysFetchFlag) return;
          
          return wayService.fetchWays()
          .then( ways => ways);
        },
        isAuthorized
      }
    },
    {
      name: 'test',
      url: '/test',
      template: require('../view/test/test.html'),
      controller: 'TestController',
      controllerAs: 'testCtrl',
      resolve: {
        isAuthorized
      },
    },
    {
      name: 'resolve',
      url: '/resolve',
      template: require('../view/resolve/resolve.html'),
      controller: 'ResolveController',
      controllerAs: 'resolveCtrl',
      resolve: {
        authService: 'authService',
        profileService: 'profileService',
        testresolve: function() {
          return 'ayo';
        },
        myprofile: function(profileService, $q, $location, $mdToast) {
          // return profileService.fetchProfile()
          // .then( profile => {
          //   console.log('resolve profile', profile);
          //   return profile;
          // })
          // .catch(e => {
          //   console.log(e);
          //   console.log('didnt login');
          //   $mdToast.showSimple('Please login');
          //   $location.url('/');
          //   return $q.reject();
          // });

          return;
        },
      },
    }
  ];

  const stateConfig = {
    onEnter
  };<commit_msg>added logic to router config to redirect to home from landing if logged in<commit_after>'use strict';

module.exports = ['$stateProvider', '$urlRouterProvider', routerConfig];

function routerConfig($stateProvider, $urlRouterProvider) {
  $urlRouterProvider.when('', '/join#signup');
  $urlRouterProvider.when('/', '/join#signup');
  $urlRouterProvider.when('/signup', '/join#signup');
  $urlRouterProvider.when('/login', '/join#login');

  let states = [
    {
      name: 'home',
      url: '/home',
      template: require('../view/home/home.html'),
      controller: 'HomeController',
      controllerAs: 'homeCtrl',
      resolve: {
        isAuthorized
      }
    },
    {
      name: 'landing',
      url: '/join',
      template: require('../view/landing/landing.html'),
      controller: 'LandingController',
      controllerAs: 'landingCtrl',
      resolve: {
        isAuthorized
      },
      onEnter: function landingOnEnter(isAuthorized, $location) {
        if (isAuthorized) $location.url('/home');
      }
    },
    {
      name: 'message',
      url: '/message',
      template: require('../view/message/message.html'),
      controller: 'MessageController',
      controllerAs: 'messageCtrl',
      resolve: {
        isAuthorized
      }
    },
    {
      name: 'way',
      url: '/way',
      template: require('../view/way/way.html'),
      controller: 'WayController',
      controllerAs: 'wayCtrl',
      resolve: {
        wayService: 'wayService',
        ways: function(wayService) {
          if (wayService.waysFetchFlag) return;

          return wayService.fetchWays()
          .then( ways => ways);
        },
        isAuthorized
      }
    },
    {
      name: 'test',
      url: '/test',
      template: require('../view/test/test.html'),
      controller: 'TestController',
      controllerAs: 'testCtrl',
      resolve: {
        isAuthorized
      },
    },
    {
      name: 'resolve',
      url: '/resolve',
      template: require('../view/resolve/resolve.html'),
      controller: 'ResolveController',
      controllerAs: 'resolveCtrl',
      resolve: {
        authService: 'authService',
        profileService: 'profileService',
        testresolve: function() {
          return 'ayo';
        },
        myprofile: function(profileService, $q, $location, $mdToast) {
          return;
        },
      },
    }
  ];

  const stateConfig = {
    onEnter
  };
{'fraction_non_alphanumeric': 0.1572452229299363, 'fraction_numerical': 0.0, 'mean_word_length': 2.067765567765568, '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': '744867', 'n_tokens_mistral': 1446, 'n_tokens_neox': 1437, 'n_words': 274}