<commit_before>//Public routes:
exposed = FlowRouter.group({
  prefix:'/welcome'
});

exposed.route('/', {
  name:'welcome',
  action: function () {
    BlazeLayout.render('app_body', {header: 'header', main: 'welcome', footer: 'footer'});
  }
})

//Logged-in routes:
loggedIn = FlowRouter.group({
  triggersEnter: [ function () {
    if(!Meteor.userId()) {
      route = FlowRouter.current();
      if(route.route.name != 'welcome') {
       Session.set('redirectAfterLogin', route.path);
      }
      FlowRouter.go('welcome');
    }
  }]
})

loggedIn.route('/', {
  name: 'dashboard',
  action: function () {
    console.log('arrived at dashboard!');
    BlazeLayout.render('app_body', {header: 'header', main: 'dashboard', footer: 'footer'});
  }
});

loggedIn.route('/userSettings', {
  action: function () {
    BlazeLayout.render('app_body', {header: 'header', main: 'userSettings', footer: 'footer'});
  }
});

loggedIn.route('/notifications', {
  action: function () {
    BlazeLayout.render('app_body', {header: 'header', main: 'viewNotifications', footer: 'footer'});
  }
});

//default:
FlowRouter.notFound = {
  action: FlowRouter.go('dashboard')
};

//Handle log in and log out
Accounts.onLogin(function () {
  var redirect = Session.get('redirectAfterLogin');
  if(redirect && redirect !== '/welcome') {
    FlowRouter.go(redirect);
  } else {
    FlowRouter.go('dashboard');
  }
});

Meteor.methods({
  checkForUser: function () {
    if(!Meteor.userId()) {
      FlowRouter.go('welcome');
    }
  }
});

Tracker.autorun(function () {
  Meteor.call('checkForUser');
});

<commit_msg>Fixes error logged to console on server restart<commit_after>//Public routes:
exposed = FlowRouter.group({
  prefix:'/welcome'
});

exposed.route('/', {
  name:'welcome',
  action: function () {
    BlazeLayout.render('app_body', {header: 'header', main: 'welcome', footer: 'footer'});
  }
})

//Logged-in routes:
loggedIn = FlowRouter.group({
  triggersEnter: [ function () {
    if(!Meteor.userId()) {
      FlowRouter.go('welcome');
    }
  }]
})

loggedIn.route('/', {
  name: 'dashboard',
  action: function () {
    BlazeLayout.render('app_body', {header: 'header', main: 'dashboard', footer: 'footer'});
  }
});

loggedIn.route('/userSettings', {
  action: function () {
    BlazeLayout.render('app_body', {header: 'header', main: 'userSettings', footer: 'footer'});
  }
});

loggedIn.route('/notifications', {
  action: function () {
    BlazeLayout.render('app_body', {header: 'header', main: 'viewNotifications', footer: 'footer'});
  }
});

//default:
FlowRouter.notFound = {
  action: FlowRouter.go('dashboard')
};

//Handle log in and log out
Accounts.onLogin(function () {
  FlowRouter.go('dashboard');
});

Meteor.methods({
  checkForUser: function () {
    if(!Meteor.userId()) {
      FlowRouter.go('welcome');
    }
  }
});

Tracker.autorun(function () {
  Meteor.call('checkForUser');
});


{'fraction_non_alphanumeric': 0.20048143053645118, 'fraction_numerical': 0.0, 'mean_word_length': 4.032871972318339, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6227646', 'n_tokens_mistral': 1000, 'n_tokens_neox': 989, 'n_words': 174}