From 7373e2930f55f05b380a9e2ec4e993edaf1b02c4 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Thu, 15 Apr 2021 18:41:28 +0200 Subject: [PATCH 1/3] refactor router to avoid redirects and misuse of children --- frontend/src/App.vue | 6 +- frontend/src/routes/routes.js | 97 ++++++++----------- frontend/src/views/Layout/Content.vue | 17 ---- .../views/Layout/DashboardLayout_gdd.spec.js | 2 + 4 files changed, 47 insertions(+), 75 deletions(-) delete mode 100755 frontend/src/views/Layout/Content.vue diff --git a/frontend/src/App.vue b/frontend/src/App.vue index f9cc4216f..fafd46b32 100755 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -17,7 +17,7 @@
- +
@@ -26,11 +26,15 @@ import { ParticlesBg } from 'particles-bg-vue' import icon from './icon.js' import { localeChanged } from 'vee-validate' +import DashboardLayout from '@/views/Layout/DashboardLayout_gdd.vue' +import AuthLayoutGDD from '@/views/Layout/AuthLayout_gdd.vue' export default { name: 'app', components: { ParticlesBg, + DashboardLayout, + AuthLayoutGDD, }, data() { return { diff --git a/frontend/src/routes/routes.js b/frontend/src/routes/routes.js index fba892f1a..b50f2a7b1 100755 --- a/frontend/src/routes/routes.js +++ b/frontend/src/routes/routes.js @@ -1,66 +1,49 @@ -import DashboardLayout from '@/views/Layout/DashboardLayout_gdd.vue' -import AuthLayoutGDD from '@/views/Layout/AuthLayout_gdd.vue' - import NotFound from '@/views/NotFoundPage.vue' const routes = [ { - path: '/login', - redirect: 'login', - component: AuthLayoutGDD, - children: [ - { - path: '/login', - component: () => import('../views/Pages/Login.vue'), - }, - { - path: '/thx', - component: () => import('../views/Pages/thx.vue'), - }, - { - path: '/register', - component: () => import('../views/Pages/Register.vue'), - }, - { - path: '/password', - component: () => import('../views/Pages/Password.vue'), - }, - { - path: '/explorer', - name: 'Explorer', - component: () => import('../views/Pages/Explorer.vue'), - }, - ], + path: '/overview', + component: () => import('../views/KontoOverview.vue'), + meta: { + requiresAuth: true, + }, }, { - path: '/overview', - redirect: 'overview', - component: DashboardLayout, - children: [ - { - path: '/overview', - component: () => import('../views/KontoOverview.vue'), - meta: { - requiresAuth: true, - }, - }, - { - path: '/profile', - component: () => import('../views/Pages/UserProfileCard.vue'), - }, - { - path: '/profileedit', - component: () => import('../views/Pages/UserProfileEdit.vue'), - }, - { - path: '/activity', - component: () => import('../views/Pages/UserProfileActivity.vue'), - }, - { - path: '/transactions', - component: () => import('../views/Pages/UserProfileTransactionList.vue'), - }, - ], + path: '/profile', + component: () => import('../views/Pages/UserProfileCard.vue'), + }, + { + path: '/profileedit', + component: () => import('../views/Pages/UserProfileEdit.vue'), + }, + { + path: '/activity', + component: () => import('../views/Pages/UserProfileActivity.vue'), + }, + { + path: '/transactions', + component: () => import('../views/Pages/UserProfileTransactionList.vue'), + }, + { + path: '/login', + component: () => import('../views/Pages/Login.vue'), + }, + { + path: '/thx', + component: () => import('../views/Pages/thx.vue'), + }, + { + path: '/register', + component: () => import('../views/Pages/Register.vue'), + }, + { + path: '/password', + component: () => import('../views/Pages/Password.vue'), + }, + { + path: '/explorer', + name: 'Explorer', + component: () => import('../views/Pages/Explorer.vue'), }, { path: '*', component: NotFound }, ] diff --git a/frontend/src/views/Layout/Content.vue b/frontend/src/views/Layout/Content.vue deleted file mode 100755 index d29de692c..000000000 --- a/frontend/src/views/Layout/Content.vue +++ /dev/null @@ -1,17 +0,0 @@ - - - diff --git a/frontend/src/views/Layout/DashboardLayout_gdd.spec.js b/frontend/src/views/Layout/DashboardLayout_gdd.spec.js index 3625df05e..269ab2074 100644 --- a/frontend/src/views/Layout/DashboardLayout_gdd.spec.js +++ b/frontend/src/views/Layout/DashboardLayout_gdd.spec.js @@ -97,7 +97,9 @@ describe('DashboardLayoutGdd', () => { // to do: get this working! it.skip('has second item "transactions" linked to transactions in navbar', async () => { + //console.log(wrapper.html()) navbar.findAll('ul > li > a').at(1).trigger('click') + //console.log(wrapper.html()) await flushPromises() await jest.runAllTimers() await flushPromises() From c39f326ebadc23324900cdd7a3f315bf2b3d6495 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Fri, 16 Apr 2021 11:42:33 +0200 Subject: [PATCH 2/3] Update frontend/src/views/Layout/DashboardLayout_gdd.spec.js Co-authored-by: Ulf Gebhardt --- frontend/src/views/Layout/DashboardLayout_gdd.spec.js | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/src/views/Layout/DashboardLayout_gdd.spec.js b/frontend/src/views/Layout/DashboardLayout_gdd.spec.js index 269ab2074..dcbe0d4b6 100644 --- a/frontend/src/views/Layout/DashboardLayout_gdd.spec.js +++ b/frontend/src/views/Layout/DashboardLayout_gdd.spec.js @@ -97,7 +97,6 @@ describe('DashboardLayoutGdd', () => { // to do: get this working! it.skip('has second item "transactions" linked to transactions in navbar', async () => { - //console.log(wrapper.html()) navbar.findAll('ul > li > a').at(1).trigger('click') //console.log(wrapper.html()) await flushPromises() From 94a51691f96a91988c3bfe8893653dff93b0a840 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Fri, 16 Apr 2021 11:42:41 +0200 Subject: [PATCH 3/3] Update frontend/src/views/Layout/DashboardLayout_gdd.spec.js Co-authored-by: Ulf Gebhardt --- frontend/src/views/Layout/DashboardLayout_gdd.spec.js | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/src/views/Layout/DashboardLayout_gdd.spec.js b/frontend/src/views/Layout/DashboardLayout_gdd.spec.js index dcbe0d4b6..3625df05e 100644 --- a/frontend/src/views/Layout/DashboardLayout_gdd.spec.js +++ b/frontend/src/views/Layout/DashboardLayout_gdd.spec.js @@ -98,7 +98,6 @@ describe('DashboardLayoutGdd', () => { // to do: get this working! it.skip('has second item "transactions" linked to transactions in navbar', async () => { navbar.findAll('ul > li > a').at(1).trigger('click') - //console.log(wrapper.html()) await flushPromises() await jest.runAllTimers() await flushPromises()