avoid repeated answers when match from API is the same

This commit is contained in:
leander committed 2025-06-20 22:50:12 +02:00
1 parent e5549499c8
commit 35c970e5f2
1 file changed
+5
+5
View File
@@ -88,6 +88,11 @@ function Home() {
});
if (res.ok) {
const data = await res.json();
if (data.name && matches.some((m) => m.name && m.name.toLowerCase() === data.name.toLowerCase())) {
setRepeatMessage(t.alreadySubmitted);
setInput("");
return;
}
setMatches((prev) => [...prev, { input: trimmedInput, ...data }]);
if (data.correct && !timerStarted) {
startTimer();