Skip to content

Commit 41350ac

Browse files
committed
preventing loosing points when trying the same word
1 parent 19008fb commit 41350ac

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

client/src/App.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,11 @@ function App() {
139139
return;
140140
}
141141

142+
if (attempts.includes(attempt)){
143+
setStatusWithTimeout("already tried");
144+
return;
145+
}
146+
142147
if (attempt.toLowerCase() != term.word) {
143148
setStatusWithTimeout("incorrect");
144149
setScore(score - 10);
@@ -193,6 +198,7 @@ function App() {
193198
cleanStatus();
194199
setTerm(get_random_term(5));
195200
setAttempt("");
201+
setAttempts([]);
196202
setKeyboardColors(Array(26).fill("square-unattempted"));
197203
}
198204

0 commit comments

Comments
 (0)