import {createRouter,createWebHistory} from 'vue-router'
import Login from "@/components/Login.vue";
import Study from "@/components/Study.vue";
import Welcome from "@/components/Welcome.vue";
import Review from "@/components/Review.vue";
import StartTask from "@/components/StartTask.vue";
import TaskForm from "@/components/TaskForm.vue";

const router = createRouter({
    history: createWebHistory(),
    routes:[
        {
          path:'/',
          redirect:'/login',
        },
        {
            path:'/login',
            component:Login
        },
        {
            path:'/welcome',
            component: Welcome
        },
        {
            path:'/study',
            component: Study
        },
        {
            path:'/review',
            component: Review
        },
        {
            path:'/start-task/:taskNum',
            name:'start-task',
            component: StartTask
        },
        {
            path:'/add-task',
            name:'add-task',
            component: TaskForm,
            meta:{
                action: 'add', buttonText: '添加'
            }
        },
        {
            path:'/update-task/:taskId',
            name:'update-task',
            component: TaskForm,
            meta:{
                action: 'update', buttonText: '更新'
            }
        }
    ]
});

export default router;