feat: Implement authentication system with token refresh and initial instructor dashboard with course management.

This commit is contained in:
Missez 2026-01-23 09:53:39 +07:00
parent 0eb9b522f6
commit ab3124628c
11 changed files with 1053 additions and 93 deletions

View file

@ -103,7 +103,7 @@
<div v-else class="space-y-4">
<q-card
v-for="chapter in course.chapters"
v-for="chapter in sortedChapters"
:key="chapter.id"
flat
bordered
@ -125,7 +125,7 @@
<!-- Lessons -->
<q-list separator class="border-t">
<q-item
v-for="lesson in chapter.lessons"
v-for="lesson in getSortedLessons(chapter)"
:key="lesson.id"
class="py-3"
>
@ -204,6 +204,11 @@ const totalLessons = computed(() => {
return course.value.chapters.reduce((sum, ch) => sum + ch.lessons.length, 0);
});
const sortedChapters = computed(() => {
if (!course.value) return [];
return course.value.chapters.slice().sort((a, b) => a.sort_order - b.sort_order);
});
// Methods
const fetchCourse = async () => {
loading.value = true;
@ -246,6 +251,10 @@ const getChapterDuration = (chapter: ChapterResponse) => {
return chapter.lessons.reduce((sum, l) => sum + l.duration_minutes, 0);
};
const getSortedLessons = (chapter: ChapterResponse) => {
return chapter.lessons.slice().sort((a, b) => a.sort_order - b.sort_order);
};
const getLessonIcon = (type: string) => {
const icons: Record<string, string> = {
VIDEO: 'play_circle',