This commit is contained in:
2025-11-25 16:08:10 -05:00
parent cb0f972a5f
commit 72971f6d3e
19 changed files with 1595 additions and 785 deletions

View File

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