🐛 Fixed incorrect errors with Slides

This commit is contained in:
Mawoka
2022-12-28 11:58:57 +01:00
parent d437d72005
commit 05779a56c1
+9 -7
View File
@@ -77,21 +77,23 @@ export const dataSchema = yup.object({
if (Array.isArray(v)) { if (Array.isArray(v)) {
try { try {
if (typeof v[0].right === 'boolean') { if (typeof v[0].right === 'boolean') {
// console.log('ABCDQuestionSchema'); console.log('ABCDQuestionSchema');
return ABCDQuestionSchema; return ABCDQuestionSchema;
} else if (v[0].answer !== undefined) { } else if (v[0].answer !== undefined) {
// console.log('VotingQuestionSchema'); console.log('VotingQuestionSchema');
return VotingQuestionSchema; return VotingQuestionSchema;
} else { } else {
// console.log('SlideQuestionSchema'); console.log('SlideQuestionSchema');
return yup.string().required(); return yup.string().required().nullable();
} }
} catch { } catch {
// console.log('SlideQuestionSchema'); console.log('SlideQuestionSchema');
return yup.string().required(); return yup.string().required("The slide mustn't be empty").nullable();
} }
} else if (typeof v === 'string' || v instanceof String) {
return yup.string().required("The slide mustn't be empty").nullable();
} else { } else {
// console.log('RangeQuestionSchema'); console.log('RangeQuestionSchema');
return RangeQuestionSchema; return RangeQuestionSchema;
} }
}) })