Added sound effects to the exam generation

This commit is contained in:
Tiago Ribeiro
2023-11-29 20:26:48 +00:00
parent 1f0e5f4a08
commit a3864eb7d3
6 changed files with 28 additions and 7 deletions

View File

@@ -1,6 +1,7 @@
import {LevelExam, MultipleChoiceExercise} from "@/interfaces/exam";
import useExamStore from "@/stores/examStore";
import {getExamById} from "@/utils/exams";
import {playSound} from "@/utils/sound";
import {Tab} from "@headlessui/react";
import axios from "axios";
import clsx from "clsx";
@@ -18,6 +19,7 @@ const TaskTab = ({exam, setExam}: {exam?: LevelExam; setExam: (exam: LevelExam)
axios
.get(`/api/exam/level/generate/level`)
.then((result) => {
playSound("check");
console.log(result.data);
setExam(result.data);
})
@@ -135,6 +137,7 @@ const LevelGeneration = () => {
axios
.post(`/api/exam/level`, exam)
.then((result) => {
playSound("sent");
console.log(`Generated Exam ID: ${result.data.id}`);
toast.success("This new exam has been generated successfully! Check the ID in our browser's console.");
setResultingExam(result.data);