fix(ui): fix timer reappearing after exam submission

This commit is contained in:
shafin-r
2025-09-01 17:13:35 +06:00
parent 5507602031
commit 5fd76bc0ec
3 changed files with 57 additions and 17 deletions

View File

@ -27,8 +27,9 @@ export default function ExamPage() {
if (fetchedTest?.metadata.time_limit_minutes) {
resetTimer(fetchedTest.metadata.time_limit_minutes * 60, () => {
// Timer ended → auto-submit exam
stopTimer();
submitExam(type);
router.push(`/categories/${type}s`);
router.push(`/exam/results`);
});
}
});
@ -56,6 +57,7 @@ export default function ExamPage() {
const handleSubmitExam = async (type: string) => {
try {
stopTimer();
setIsSubmitting(true);
await submitExam(type);
router.push(`/exam/results`);