Added title to the exam generate
This commit is contained in:
@@ -230,7 +230,11 @@ const TaskTab = ({section, setSection}: {section: LevelSection; setSection: (sec
|
||||
);
|
||||
};
|
||||
|
||||
const LevelGeneration = () => {
|
||||
interface Props {
|
||||
id: string;
|
||||
}
|
||||
|
||||
const LevelGeneration = ({ id } : Props) => {
|
||||
const [generatedExam, setGeneratedExam] = useState<LevelExam>();
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [resultingExam, setResultingExam] = useState<LevelExam>();
|
||||
@@ -420,10 +424,16 @@ const LevelGeneration = () => {
|
||||
return;
|
||||
}
|
||||
|
||||
if(!id) {
|
||||
toast.error("Please insert a title before submitting");
|
||||
return;
|
||||
}
|
||||
|
||||
setIsLoading(true);
|
||||
|
||||
const exam = {
|
||||
...generatedExam,
|
||||
id,
|
||||
parts: generatedExam.parts.map((p, i) => ({...p, exercises: parts[i].part!.exercises})),
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user