round 1
This commit is contained in:
@@ -1,25 +1,26 @@
|
||||
import { createRouter, createWebHistory } from 'vue-router'
|
||||
import { isParentAuthenticated } from '../stores/auth'
|
||||
import ChildLayout from '../layout/ChildLayout.vue'
|
||||
import ChildrenList from '../components/ChildrenList.vue'
|
||||
import ChildView from '../components/ChildView.vue'
|
||||
import ParentView from '../components/ParentView.vue'
|
||||
import ParentLayout from '../layout/ParentLayout.vue'
|
||||
import ChildrenListView from '../components/ChildrenListView.vue'
|
||||
import ChildView from '../components/child/ChildView.vue'
|
||||
import ParentView from '../components/child/ParentView.vue'
|
||||
import TaskView from '../components/task/TaskView.vue'
|
||||
import RewardView from '../components/reward/RewardView.vue'
|
||||
import TaskEditView from '@/components/task/TaskEditView.vue'
|
||||
|
||||
const routes = [
|
||||
{
|
||||
path: '/child',
|
||||
name: 'ChildLayout',
|
||||
component: ChildLayout,
|
||||
children: [
|
||||
{
|
||||
path: '', // /child
|
||||
name: 'ChildrenList',
|
||||
component: ChildrenList,
|
||||
path: '',
|
||||
name: 'ChildrenListView',
|
||||
component: ChildrenListView,
|
||||
},
|
||||
{
|
||||
path: ':id', // /child/:id
|
||||
name: 'ChildDetailView',
|
||||
path: ':id',
|
||||
name: 'ChildView',
|
||||
component: ChildView,
|
||||
props: true,
|
||||
},
|
||||
@@ -27,21 +28,43 @@ const routes = [
|
||||
},
|
||||
{
|
||||
path: '/parent',
|
||||
name: 'ParentLayout',
|
||||
component: ParentLayout,
|
||||
meta: { requiresAuth: true },
|
||||
children: [
|
||||
{
|
||||
path: '', // /parent
|
||||
name: 'ParentChildrenList',
|
||||
component: ChildrenList,
|
||||
path: '',
|
||||
name: 'ParentChildrenListView',
|
||||
component: ChildrenListView,
|
||||
},
|
||||
{
|
||||
path: ':id',
|
||||
name: 'ParentChildDetailView',
|
||||
name: 'ParentView',
|
||||
component: ParentView,
|
||||
props: true,
|
||||
},
|
||||
{
|
||||
path: 'tasks',
|
||||
name: 'TaskView',
|
||||
component: TaskView,
|
||||
props: false,
|
||||
},
|
||||
{
|
||||
path: 'tasks/create',
|
||||
name: 'CreateTask',
|
||||
component: TaskEditView,
|
||||
},
|
||||
{
|
||||
path: 'tasks/:id/edit',
|
||||
name: 'EditTask',
|
||||
component: TaskEditView,
|
||||
props: true,
|
||||
},
|
||||
{
|
||||
path: 'rewards',
|
||||
name: 'RewardView',
|
||||
component: RewardView,
|
||||
props: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
@@ -49,9 +72,10 @@ const routes = [
|
||||
redirect: '/child',
|
||||
},
|
||||
]
|
||||
import { isParentAuthenticated } from '../stores/auth'
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(import.meta.env.BASE_URL),
|
||||
history: createWebHistory(),
|
||||
routes,
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user