fix: Added if statement for preventing use of reserved word in question ID (#1435)

This commit is contained in:
Aditya Ghidora
2023-10-28 22:20:20 +05:30
committed by GitHub
parent 966dd5fcc8
commit a92189c7aa

View File

@@ -40,6 +40,11 @@ export default function UpdateQuestionId({
updateQuestion(questionIdx, { id: prevValue });
toast.error("ID should not be empty.");
return;
} else if (currentValue === "source" || currentValue === "suID" || currentValue === "userId") {
setCurrentValue(prevValue);
updateQuestion(questionIdx, { id: prevValue });
toast.error("ID cannot used reserved words.");
return;
} else {
setIsInputInvalid(false);
toast.success("Question ID updated.");