add error message and stop loading if something went wrong while loading exam in approval workflow
This commit is contained in:
@@ -72,7 +72,7 @@ export async function createApprovalWorkflowOnExamCreation(examAuthor: string, e
|
|||||||
if (totalCount === 0) { // current behaviour: if no workflow was found skip approval process
|
if (totalCount === 0) { // current behaviour: if no workflow was found skip approval process
|
||||||
await db.collection(examModule).updateOne(
|
await db.collection(examModule).updateOne(
|
||||||
{ id: examId },
|
{ id: examId },
|
||||||
{ $set: { id: examId, isDiagnostic: false }},
|
{ $set: { id: examId, access: "private" }},
|
||||||
{ upsert: true }
|
{ upsert: true }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -261,7 +261,7 @@ export default function Home({ user, initialWorkflow, id, workflowAssignees, wor
|
|||||||
const exam = await getExamById(examModule, examId.trim());
|
const exam = await getExamById(examModule, examId.trim());
|
||||||
if (!exam) {
|
if (!exam) {
|
||||||
toast.error(
|
toast.error(
|
||||||
"Unknown Exam ID! Please make sure you selected the right module and entered the right exam ID",
|
"Something went wrong while fetching exam!",
|
||||||
{ toastId: "invalid-exam-id" }
|
{ toastId: "invalid-exam-id" }
|
||||||
);
|
);
|
||||||
setViewExamIsLoading(false);
|
setViewExamIsLoading(false);
|
||||||
@@ -272,6 +272,13 @@ export default function Home({ user, initialWorkflow, id, workflowAssignees, wor
|
|||||||
payload: { exams: [exam], modules: [examModule] },
|
payload: { exams: [exam], modules: [examModule] },
|
||||||
});
|
});
|
||||||
router.push("/exam");
|
router.push("/exam");
|
||||||
|
} else {
|
||||||
|
toast.error(
|
||||||
|
"Something went wrong while fetching exam!",
|
||||||
|
{ toastId: "invalid-exam-id" }
|
||||||
|
);
|
||||||
|
setViewExamIsLoading(false);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user