Skip to content
Snippets Groups Projects
Commit d995518e authored by Adam Procter's avatar Adam Procter
Browse files

Merge branch 'main' into futurenogg

parents 026c457b 40d69b9c
Branches
No related tags found
No related merge requests found
import { createRouter, createWebHistory } from 'vue-router' import { createRouter, createWebHistory } from 'vue-router'
import Start from '../views/Start.vue' import Start from '../views/Start.vue'
function guardMyroute(to, from, next) {
var hasMicrocosm = false
if (localStorage.getItem('nogg_microcosm')) hasMicrocosm = true
else hasMicrocosm = false
if (hasMicrocosm) {
next() // allow to enter route
} else {
next('/') // go to '/'
}
}
const routes = [ const routes = [
{ {
path: '/', path: '/',
...@@ -19,6 +30,7 @@ const routes = [ ...@@ -19,6 +30,7 @@ const routes = [
{ {
path: '/collect', path: '/collect',
name: 'Collect', name: 'Collect',
beforeEnter: guardMyroute,
// route level code-splitting // route level code-splitting
// this generates a separate chunk (credits.[hash].js) for this route // this generates a separate chunk (credits.[hash].js) for this route
// which is lazy-loaded when the route is visited. // which is lazy-loaded when the route is visited.
...@@ -29,6 +41,7 @@ const routes = [ ...@@ -29,6 +41,7 @@ const routes = [
{ {
path: '/cards', path: '/cards',
name: 'Cards', name: 'Cards',
beforeEnter: guardMyroute,
// route level code-splitting // route level code-splitting
// this generates a separate chunk (credits.[hash].js) for this route // this generates a separate chunk (credits.[hash].js) for this route
// which is lazy-loaded when the route is visited. // which is lazy-loaded when the route is visited.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment