feat: Add useCourse composable for course data management and a new discovery page.

This commit is contained in:
supalerk-ar66 2026-01-21 13:30:32 +07:00
parent 327f6ec7b5
commit 8f38f795e6
2 changed files with 13 additions and 6 deletions

View file

@ -86,12 +86,6 @@ const handleEnroll = async (id: number) => {
if (res.success) {
// Navigate to my-courses where the success modal will be shown
return navigateTo('/dashboard/my-courses?enrolled=true');
} else if (res.code === 409) {
// Already enrolled, maybe redirect to course learning page or my-courses?
// For now, let's redirect to my-courses as well, maybe with a different param or just same.
// User requirement didn't specify distinct behavior for 409 in UI terms,
// but 'Already enrolled' implies they should go see it.
return navigateTo('/dashboard/my-courses');
} else {
alert(res.error || 'Failed to enroll');
}