mirror of
https://github.com/FranP-code/Hangman-game-with-React.git
synced 2025-10-13 00:42:32 +00:00
Fixes and change of Firebase API KEY
This commit is contained in:
@@ -96,8 +96,6 @@ const AddWord = () => {
|
||||
splitedWords = splitedWords.map(word => word.toLowerCase())
|
||||
splitedWords = splitedWords.map(word => capitalize(word))
|
||||
|
||||
console.log(categoryForDatabase);
|
||||
|
||||
const uploadWordsPromise = new Promise((resolve, reject) => {
|
||||
|
||||
splitedWords.forEach(async (word, index) => {
|
||||
|
||||
@@ -12,7 +12,6 @@ const getCategoryForDatabase = async (categorySelection, LanguageSelection) => {
|
||||
const categoryLocalizated = categoryFirebase.data()[LanguageSelection]
|
||||
|
||||
return await categoryLocalizated
|
||||
console.log(categoryLocalizated)
|
||||
|
||||
} catch (error) {
|
||||
|
||||
|
||||
@@ -6,39 +6,6 @@ const DeleteCategoryFirebase = async (category, setData) => {
|
||||
try {
|
||||
|
||||
const db = getFirestore(firestore)
|
||||
|
||||
// const categoryEnglishRef = await doc(db, 'categories', category)
|
||||
// const categoryEnglishSnap = await getDoc(categoryEnglishRef)
|
||||
// const categoryEnglish = categoryEnglishSnap.data()['english'].toLowerCase()
|
||||
|
||||
// const categorySpanishRef = await doc(db, 'categories', category)
|
||||
// const categorySpanishSnap = await getDoc(categorySpanishRef)
|
||||
// const categorySpanish = categorySpanishSnap.data()['spanish'].toLowerCase()
|
||||
|
||||
// console.log(categoryEnglish)
|
||||
// console.log(categorySpanish)
|
||||
|
||||
// const collectionWordsCategoryEnglish = await collection(db, `hangman_words/english/${categoryEnglish}`)
|
||||
// const wordsCategoryEnglishRef = await getDocs(collectionWordsCategoryEnglish)
|
||||
// const wordsCategoryEnglish = await wordsCategoryEnglishRef.docs
|
||||
|
||||
// console.log(wordsCategoryEnglish)
|
||||
|
||||
// const deleteWordsCategoryEnglishPromise = new Promise((resolve, reject) => {
|
||||
|
||||
// wordsCategoryEnglish.forEach(async (documentInCategory, index) => {
|
||||
|
||||
// console.log(await documentInCategory.id)
|
||||
// await deleteDoc(doc(db, `hangman_words/english/${categoryEnglish}`, documentInCategory.id))
|
||||
|
||||
// if (index === wordsCategoryEnglish.length -1) resolve();
|
||||
// })
|
||||
// })
|
||||
|
||||
// deleteWordsCategoryEnglishPromise.then(() => {
|
||||
// deleteDoc(doc(db, `hangman_words/english/`, categoryEnglish))
|
||||
// })
|
||||
|
||||
await deleteDoc(doc(db, 'categories', category))
|
||||
|
||||
} catch (error) {
|
||||
|
||||
@@ -65,10 +65,10 @@ function Game() {
|
||||
setSelectedWord('a')
|
||||
|
||||
let word = await BringTheWords(language, category, selectedWord)
|
||||
word = word.toLowerCase()
|
||||
word = word.toLowerCase()
|
||||
|
||||
await setSelectedWord(word)
|
||||
await setDisplayApp(true)
|
||||
setSelectedWord(word)
|
||||
setDisplayApp(true)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ function Game() {
|
||||
AlmacenateLanguage(language)
|
||||
|
||||
window.location.reload(false)
|
||||
}, 3000)
|
||||
}, 3000)
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -3,8 +3,6 @@ import {getFirestore, collection, doc, setDoc } from "firebase/firestore/lite";
|
||||
|
||||
const AddPokemonToFirebaseQuery = async (language, pokemon) => {
|
||||
|
||||
console.log(pokemon)
|
||||
console.log(language)
|
||||
try {
|
||||
const db = await getFirestore(firestore)
|
||||
const result = await setDoc(doc(db, `hangman_words/${language}/pokemons`, pokemon.name), {
|
||||
|
||||
@@ -10,7 +10,6 @@ const PokemonScripts = () => {
|
||||
const response = await fetch('https://pokeapi.co/api/v2/pokemon?limit=151')
|
||||
const pokemons = await response.json()
|
||||
|
||||
console.log(pokemons)
|
||||
|
||||
const uploadWordsPromise = new Promise((resolve, reject) => {
|
||||
|
||||
@@ -24,14 +23,6 @@ const PokemonScripts = () => {
|
||||
|
||||
await uploadWordsPromise.then(() => {})
|
||||
|
||||
// await pokemons.results.forEach(async (pokemon) => {
|
||||
// console.log(pokemon.name)
|
||||
|
||||
// await AddPokemonToFirebaseQuery('english', pokemon)
|
||||
// });
|
||||
|
||||
console.log(pokemons.results.length)
|
||||
|
||||
} catch (error) {
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user