diff --git a/src/router/index.ts b/src/router/index.ts index 38a3037..e4a76fa 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,7 +1,7 @@ import { createRouter, createWebHistory } from 'vue-router' import HomeView from '@/views/HomeView.vue' import MapView from '@/views/MapView.vue' -import MianView from '@/views/MianView.vue' +import MainView from '@/views/MainView.vue' import keycloak from '@/plugins/keycloak' @@ -11,7 +11,7 @@ const router = createRouter({ { path: '/', name: 'home', - component: MianView, + component: MainView, children: [ { path: '/', @@ -45,14 +45,14 @@ const router = createRouter({ name: 'history', component: () => import('@/views/HistoryView.vue'), meta: { - Auth: true, + Auth: false, }, }, - // { - // path: '/camera', - // name: 'camera', - // component: () => import('@/views/SampleCamera.vue'), - // }, + { + path: '/auth', + name: 'auth', + component: () => import('@/views/auth.vue'), + }, /** * 404 Not Found * ref: https://router.vuejs.org/guide/essentials/dynamic-matching.html#catch-all-404-not-found-route @@ -75,18 +75,18 @@ router.beforeEach((to, from, next) => { console.log('keycloak===>', keycloak) console.log('keycloak authenticated===>', keycloak.authenticated) - // if (keycloak.authenticated === undefined) { - // window.location.href = 'https://bma-sso.frappet.synology.me' - // } else { - // // keycloak.updateToken(60); - // // const role = keycloak.tokenParsed?.role - // // if (role.includes(to.meta.Role)) { - // next() - // // } else { - // // next({ path: '' }) - // // // next(); - // // } - // } + if (keycloak.authenticated === undefined) { + window.location.href = 'https://bma-sso.frappet.synology.me' + // } else { + // // keycloak.updateToken(60); + // // const role = keycloak.tokenParsed?.role + // // if (role.includes(to.meta.Role)) { + // next() + // // } else { + // // next({ path: '' }) + // // // next(); + // // } + } } else { next() } diff --git a/src/views/MianView.vue b/src/views/MainView.vue similarity index 100% rename from src/views/MianView.vue rename to src/views/MainView.vue diff --git a/src/views/auth.vue b/src/views/auth.vue new file mode 100644 index 0000000..4c2d5c4 --- /dev/null +++ b/src/views/auth.vue @@ -0,0 +1,30 @@ + + +