feat: implement core e-learning pages, course composable, and i18n localization.

This commit is contained in:
supalerk-ar66 2026-02-09 11:40:41 +07:00
parent f736eb7f38
commit e94410d0e7
9 changed files with 235 additions and 138 deletions

View file

@ -13,7 +13,7 @@ definePageMeta({
const route = useRoute()
// courseId URL params ( integer)
const courseId = computed(() => parseInt(route.params.id as string))
const { fetchCourseById, enrollCourse } = useCourse()
const { fetchCourseById, enrollCourse, getLocalizedText } = useCourse()
// useAsyncData Server-side rendering (SSR)
// Key: 'course-{id}' cache ID
@ -54,12 +54,6 @@ const handleEnroll = async () => {
}
const getLocalizedText = (text: string | { th: string; en: string } | undefined | null) => {
if (!text) return ''
if (typeof text === 'string') return text
// @ts-ignore
return text.th || text.en || ''
}
useHead({