bug fixes

This commit is contained in:
2021-10-15 18:20:23 -03:00
parent 95bae8a765
commit 0d1f51ded8
2 changed files with 18 additions and 15 deletions

View File

@@ -48,7 +48,7 @@ function App() {
document.title = titleAPP.spanish
}
})
}, [])
if (isVictory || isDefeat) {

View File

@@ -30,20 +30,6 @@ const PuzzleWord = ({hangmanFrame, setHangmanFrame, currentScore, setCurrentScor
puzzleWord.appendChild(counter)
}
const definePuzzle = async () => {
const words = await BringTheWords(language, category)
const wordSelection = await SelectRandomWord(words)
const word = await words[wordSelection]
await setActualWord(word)
}
if (!displayApp && !actualWord) {
definePuzzle()
}
if (actualWord && !displayApp) {
@@ -58,6 +44,23 @@ const PuzzleWord = ({hangmanFrame, setHangmanFrame, currentScore, setCurrentScor
React.useEffect(() => {
const definePuzzle = async () => {
const words = await BringTheWords(language, category)
const wordSelection = await SelectRandomWord(words)
const word = await words[wordSelection]
setActualWord(word)
}
if (!displayApp && !actualWord) {
definePuzzle()
}
if (displayApp) {
Register_Input(actualWord, hangmanFrame, setHangmanFrame, setIsVictory, setIsDefeat)