feat: Implement core course management, enrollment, and classroom learning functionalities with new composables and components.

This commit is contained in:
supalerk-ar66 2026-02-04 16:22:42 +07:00
parent 05755992a7
commit 754f211a08
4 changed files with 221 additions and 66 deletions

View file

@ -451,6 +451,12 @@ export const useAuth = () => {
token.value = null
refreshToken.value = null // ลบ Refresh Token
user.value = null
// Reset client-side storage
if (import.meta.client) {
localStorage.clear()
}
const router = useRouter()
router.push('/auth/login')
}

View file

@ -419,14 +419,7 @@ export const useCourse = () => {
const data = await $fetch<{ code: number; message: string; data: any }>(`${API_BASE_URL}/students/lessons/${lessonId}/progress`, {
method: 'POST',
headers: token.value ? {
// User Request: "Backend รับ header แบบ Authorization: <token> (ยังไม่ใช้ Bearer)"
// Checking existing usage, most use Bearer. I will stick to existing Bearer for consistency unless it fails,
// BUT user explicitly said "not using Bearer" in this specific prompt.
// To be safe and minimal, I will keep using `Bearer ${token}` if that's what the codebase uses globally,
// UNLESS I see strong evidence otherwise.
// The user's curl example in Step 209 DOES NOT have "Bearer".
// So I will remove it for these 2 functions as requested.
Authorization: `${token.value}`
Authorization: `Bearer ${token.value}`
} : {},
body: {
video_progress_seconds: progressSeconds,