Merge pull request #194 from gradido/refactor-router

refactor: Redirects and Misuse of Children in Router
This commit is contained in:
Moriz Wahl 2021-04-16 12:09:59 +02:00 committed by GitHub
commit 61a218b80f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 45 additions and 75 deletions

View File

@ -17,7 +17,7 @@
</header>
<div class="">
<particles-bg type="custom" :config="config" :bg="true" />
<router-view />
<component :is="$store.state.session_id ? 'DashboardLayout' : 'AuthLayoutGDD'" />
</div>
</div>
</template>
@ -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 {

View File

@ -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 },
]

View File

@ -1,17 +0,0 @@
<template>
<div class="content">
<fade-transition :duration="200" mode="out-in">
<!-- your content here -->
<router-view></router-view>
</fade-transition>
</div>
</template>
<script>
import { FadeTransition } from 'vue2-transitions'
export default {
components: {
FadeTransition,
},
}
</script>
<style></style>