diff --git a/frontend/src/layouts/MainLayout.vue b/frontend/src/layouts/MainLayout.vue
index 7088b57..3eb6c40 100644
--- a/frontend/src/layouts/MainLayout.vue
+++ b/frontend/src/layouts/MainLayout.vue
@@ -1,9 +1,23 @@
-
+
-
- git-extract
+
+ git-extract
+
+
+
+
+
+
+
+
+ {{ auth.user?.login || auth.user?.username }}
+
+
+
+
+
@@ -14,11 +28,14 @@
diff --git a/frontend/src/pages/ExtractPage.vue b/frontend/src/pages/ExtractPage.vue
new file mode 100644
index 0000000..2b79c4e
--- /dev/null
+++ b/frontend/src/pages/ExtractPage.vue
@@ -0,0 +1,5 @@
+
+
+ Extract
+
+
diff --git a/frontend/src/router/index.js b/frontend/src/router/index.js
index f3c9674..7a3f5cb 100644
--- a/frontend/src/router/index.js
+++ b/frontend/src/router/index.js
@@ -1,6 +1,7 @@
import { route } from 'quasar/wrappers'
import { createRouter, createMemoryHistory, createWebHistory, createWebHashHistory } from 'vue-router'
import routes from './routes'
+import { useAuthStore } from '../stores/auth.js'
export default route(function (/* { store, ssrContext } */) {
const createHistory = process.env.SERVER
@@ -15,5 +16,11 @@ export default route(function (/* { store, ssrContext } */) {
history: createHistory(process.env.VUE_ROUTER_BASE),
})
+ Router.beforeEach((to) => {
+ if (to.meta.requiresAuth && !useAuthStore().isLoggedIn) {
+ return '/login'
+ }
+ })
+
return Router
})
diff --git a/frontend/src/router/routes.js b/frontend/src/router/routes.js
index 4cbef8e..91043bb 100644
--- a/frontend/src/router/routes.js
+++ b/frontend/src/router/routes.js
@@ -3,17 +3,15 @@ const routes = [
path: '/',
component: () => import('layouts/MainLayout.vue'),
children: [
- { path: '', component: () => import('pages/IndexPage.vue') },
+ { path: '', redirect: '/repos' },
{ path: '/login', component: () => import('pages/LoginPage.vue') },
{ path: '/auth/github', component: () => import('pages/AuthCallback.vue') },
{ path: '/auth/gitlab', component: () => import('pages/AuthCallback.vue') },
- { path: '/repos', component: () => import('pages/ReposPage.vue') },
+ { path: '/repos', component: () => import('pages/ReposPage.vue'), meta: { requiresAuth: true } },
+ { path: '/extract', component: () => import('pages/ExtractPage.vue'), meta: { requiresAuth: true } },
],
},
- {
- path: '/:catchAll(.*)*',
- component: () => import('pages/ErrorNotFound.vue'),
- },
+ { path: '/:catchAll(.*)*', component: () => import('pages/ErrorNotFound.vue') },
]
export default routes