{"size": 1443, "ext": "js", "max_stars_repo_path": "content/ClientApp/router/routes.js", "max_stars_repo_name": "GamesOfSummer/netcore_and_vue.js", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "content/ClientApp/router/routes.js", "max_issues_repo_name": "GamesOfSummer/netcore_and_vue.js", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "content/ClientApp/router/routes.js", "max_forks_repo_name": "GamesOfSummer/netcore_and_vue.js", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 19.24, "max_line_length": 56, "alphanum_fraction": 0.6063756064}
import CounterExample from 'components/counter-example';
import FetchData from 'components/fetch-data';
import HomePage from 'components/home-page';
import About from 'components/about';

import Login from 'components/Login/Login';
import Logout from 'components/Logout/Logout';

import store from '../store';

const ifNotAuthenticated = (to, from, next) => {
  if (!store.getters.isAuthenticated) {
    next();
    return;
  }
  next('/');
};

const ifAuthenticated = (to, from, next) => {
  if (store.getters.isAuthenticated) {
    next();
    return;
  }
  next('/login');
};

export const routes = [
  {
    name: 'Login',
    path: '/login',
    component: Login,
    display: 'Login',
    icon: 'list'
  },
  {
    name: 'Logout',
    path: '/logout',
    component: Logout,
    display: 'Logout',
    icon: 'list'
  },
  {
    name: 'home',
    path: '/',
    component: HomePage,
    display: 'Home',
    icon: 'home',
    beforeEnter: ifAuthenticated
  },
  {
    name: 'about',
    path: '/about',
    component: About,
    display: 'About Template',
    icon: 'info',
    beforeEnter: ifAuthenticated
  },
  {
    name: 'counter',
    path: '/counter',
    component: CounterExample,
    display: 'Counter',
    icon: 'graduation-cap',
    beforeEnter: ifAuthenticated
  },
  {
    name: 'fetch-data',
    path: '/fetch-data',
    component: FetchData,
    display: 'Data',
    icon: 'list',
    beforeEnter: ifAuthenticated
  }
];
