feat: Implement e-learning classroom with video playback, progress tracking, and quiz functionality, alongside new course and category composables and Thai localization.

This commit is contained in:
supalerk-ar66 2026-01-29 13:17:58 +07:00
parent 9232b6a21d
commit 4c575dc734
5 changed files with 570 additions and 169 deletions

View file

@ -73,6 +73,24 @@ export const useCategory = () => {
}
} catch (err: any) {
console.error('Fetch categories failed:', err)
// Retry logic for 429 Too Many Requests
if (err.statusCode === 429 || err.status === 429) {
await new Promise(resolve => setTimeout(resolve, 1500)); // Wait 1.5s
try {
const retryRes = await $fetch<CategoryResponse>(`${API_BASE_URL}/categories`, {
method: 'GET',
headers: token.value ? { Authorization: `Bearer ${token.value}` } : {}
})
const cats = retryRes.data?.categories || []
categoriesState.value = cats
isLoaded.value = true
return { success: true, data: cats, total: retryRes.data?.total || 0 }
} catch (retryErr) {
console.error('Retry fetch categories failed:', retryErr)
}
}
return {
success: false,
error: err.data?.message || err.message || 'Error fetching categories'