feat: Introduce useCourse and useAuth composables, and add new pages for user registration and dynamic course details.

This commit is contained in:
supalerk-ar66 2026-01-22 11:04:57 +07:00
parent ffd2d55e33
commit 7b22699b13
4 changed files with 7 additions and 46 deletions

View file

@ -1,6 +1,3 @@
import type { H3Event } from 'h3'
// Types based on API responses
export interface Course {
id: number
title: string | { th: string; en: string }
@ -10,7 +7,7 @@ export interface Course {
price: string
is_free: boolean
have_certificate: boolean
status: string // 'DRAFT' | 'PUBLISHED' | ...
status: string
category_id: number
created_at?: string
updated_at?: string
@ -20,10 +17,10 @@ export interface Course {
approved_by?: number
rejection_reason?: string
// Helper properties for UI (may be computed or mapped)
rating?: string
lessons?: number | string
levelType?: 'neutral' | 'warning' | 'success' // For UI badging
levelType?: 'neutral' | 'warning' | 'success'
chapters?: {
id: number
@ -45,7 +42,7 @@ interface CourseResponse {
}
export interface EnrolledCourse {
id: number // enrollment_id
id: number
course_id: number
course: Course
status: 'ENROLLED' | 'IN_PROGRESS' | 'COMPLETED' | 'DROPPED'