From 58bb7bdc8eda377ccd4d84995b2ae15dab02028c Mon Sep 17 00:00:00 2001 From: isabellirosa Date: Fri, 12 Jul 2024 14:19:51 -0300 Subject: [PATCH] FEAT: Adding children layouts #31 --- src/components/home/DefaultHome.vue | 1 - src/layouts/BlankLayout.vue | 5 ++ src/layouts/DefaultLayout.vue | 11 ++++ src/layouts/GraphLayout.vue | 10 ++++ src/pages/AboutView.vue | 5 -- src/pages/ArticleView.vue | 5 -- src/pages/AuthorView.vue | 5 -- src/pages/FavoriteView.vue | 6 -- src/pages/GraphView.vue | 3 +- src/pages/HomeView.vue | 5 +- src/pages/ProfileView.vue | 11 +--- src/router/index.ts | 93 +++++++++++++++++------------ 12 files changed, 85 insertions(+), 75 deletions(-) create mode 100644 src/layouts/BlankLayout.vue create mode 100644 src/layouts/DefaultLayout.vue create mode 100644 src/layouts/GraphLayout.vue diff --git a/src/components/home/DefaultHome.vue b/src/components/home/DefaultHome.vue index e3cf3ba..bd504bd 100644 --- a/src/components/home/DefaultHome.vue +++ b/src/components/home/DefaultHome.vue @@ -32,7 +32,6 @@ const templateStore = useTemplateStore(); - diff --git a/src/pages/ProfileView.vue b/src/pages/ProfileView.vue index aa10cd8..d5a74f4 100644 --- a/src/pages/ProfileView.vue +++ b/src/pages/ProfileView.vue @@ -1,12 +1,3 @@ - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/src/router/index.ts b/src/router/index.ts index b58d7ee..5fd7d1b 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -5,49 +5,68 @@ const router = createRouter({ routes: [ { path: '/', - name: 'home', - component: () => import('../pages/HomeView.vue') + component: () => import('../layouts/DefaultLayout.vue'), + children: [ + { + path: '/', + name: 'home', + component: () => import('../pages/HomeView.vue'), + }, + { + path: '/about', + name: 'about', + component: () => import('../pages/AboutView.vue'), + }, + { + path: '/article', + name: 'article', + component: () => import('../pages/ArticleView.vue'), + }, + { + path: '/author', + name: 'author', + component: () => import('../pages/AuthorView.vue'), + }, + { + path: '/favorite', + name: 'favorite', + component: () => import('../pages/FavoriteView.vue'), + meta: { + requiresAuth: true + } + }, + { + path: '/profile', + name: 'profile', + component: () => import('../pages/ProfileView.vue'), + meta: { + requiresAuth: true + } + }, + + ], }, { path: '/graph', - name: 'graph', - component: () => import('../pages/GraphView.vue') - }, - { - path: '/about', - name: 'about', - component: () => import('../pages/AboutView.vue') - }, - { - path: '/article', - name: 'article', - component: () => import('../pages/ArticleView.vue') - }, - { - path: '/author', - name: 'author', - component: () => import('../pages/AuthorView.vue') - }, - { - path: '/favorite', - name: 'favorite', - component: () => import('../pages/FavoriteView.vue'), - meta: { - requiresAuth: true - } - }, - { - path: '/profile', - name: 'profile', - component: () => import('../pages/ProfileView.vue'), - meta: { - requiresAuth: true - } + component: () => import('../layouts/GraphLayout.vue'), + children: [ + { + path: '/', + name: 'graph', + component: () => import('../pages/GraphView.vue'), + }, + ] }, { path: '/login', - name: 'login', - component: () => import('../pages/LoginView.vue') + component: () => import('../layouts/BlankLayout.vue'), + children: [ + { + path: '/', + name: 'login', + component: () => import('../pages/LoginView.vue'), + }, + ] } ] })