Administrator approval is now required for registering new accounts. If you are registering a new account, and are external to the University, please ask the repository owner to contact ServiceLine to request your account be approved. Repository owners must include the newly registered email address, and specific repository in the request for approval.

Commit 40d69b9c authored by Adam Procter's avatar Adam Procter
Browse files

guarded routes when you have no microcosm

parent a976448d
import { createRouter, createWebHistory } from 'vue-router'
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 = [
{
path: '/',
......@@ -19,6 +30,7 @@ const routes = [
{
path: '/collect',
name: 'Collect',
beforeEnter: guardMyroute,
// route level code-splitting
// this generates a separate chunk (credits.[hash].js) for this route
// which is lazy-loaded when the route is visited.
......@@ -29,6 +41,7 @@ const routes = [
{
path: '/cards',
name: 'Cards',
beforeEnter: guardMyroute,
// route level code-splitting
// this generates a separate chunk (credits.[hash].js) for this route
// which is lazy-loaded when the route is visited.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment