This commit is contained in:
sajjadtalkhabi
2026-05-15 17:12:51 +03:30
parent b8ced45375
commit c82701888a
101 changed files with 8125 additions and 96 deletions
+27
View File
@@ -0,0 +1,27 @@
import { register } from '@/services/mock/registry'
import { endpoints } from '@/services/api/endpoints'
import { studentExams } from '@/services/mock/fixtures/student-exams'
register('GET', endpoints.showStudentExam, ({ params }) => {
const exam = studentExams.find((e) => String(e.id) === String(params.id))
if (exam) return { data: exam }
const fallback = studentExams[1]
return { data: { ...fallback, id: params.id } }
})
register('POST', endpoints.startStudentExamAttempt, ({ params }) => ({
data: { id: params.id, status: 'started', message: 'آزمون آغاز شد' },
}))
register('POST', endpoints.submitStudentExamAttempt, ({ params, data }) => {
const answers = data?.answers || {}
const total = Object.keys(answers).length
return {
data: {
id: params.id,
submitted: true,
score: total > 0 ? (12 + Math.random() * 6).toFixed(2) : 0,
message: 'پاسخ‌های شما با موفقیت ثبت شد.',
},
}
})