feat: add new pages for authentication (register, forgot password) and course browsing (discovery, course detail)
This commit is contained in:
parent
acff387a9b
commit
d4f84667dc
4 changed files with 39 additions and 8 deletions
|
|
@ -14,6 +14,7 @@ const route = useRoute()
|
|||
// ดึง courseId จาก URL params (แปลงเป็น integer)
|
||||
const courseId = computed(() => parseInt(route.params.id as string))
|
||||
const { currentUser } = useAuth()
|
||||
const $q = useQuasar()
|
||||
const { fetchCourseById, enrollCourse, getLocalizedText } = useCourse()
|
||||
|
||||
// ใช้ useAsyncData ดึงข้อมูลคอร์ส Server-side rendering (SSR)
|
||||
|
|
@ -46,9 +47,14 @@ const handleEnroll = async () => {
|
|||
course_id: String(targetId)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
// กรณี error แสดง alert (อนาคตอาจเปลี่ยนเป็น Toast notification)
|
||||
alert(res.error || 'Failed to enroll')
|
||||
// กรณี error แสดง Toast notification แทน alert
|
||||
$q.notify({
|
||||
type: 'negative',
|
||||
message: res.error || 'Failed to enroll',
|
||||
position: 'top',
|
||||
timeout: 3000,
|
||||
actions: [{ icon: 'close', color: 'white' }]
|
||||
})
|
||||
}
|
||||
|
||||
isEnrolling.value = false
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue