diff --git a/client/src/components/GetQuestion.jsx b/client/src/components/GetQuestion.jsx index f53b42c..7c11929 100644 --- a/client/src/components/GetQuestion.jsx +++ b/client/src/components/GetQuestion.jsx @@ -1,6 +1,5 @@ import { TruckId } from "./Truck"; -import { AppContext } from './AppContext'; -import React, {useContext, useEffect, useState} from 'react'; +import React, {useEffect} from 'react'; import { ButtonShowCorrectAnswer } from "./GetImageAndQuestion"; export let EndCacheId = ""; export let EndCorrectAnswer = ""; @@ -8,20 +7,20 @@ export let EndCorrectAnswer = ""; const FetchData = ({isClick,score,setIsClick,setScore,navigate}) => { - - useEffect(() => { - fetch(`/random-question?fire-truck=${TruckId}`) - .then(res => res.json()) - .then(dataQuestion => { - if(isClick) { - const propertValuesObjectFromDb = Object.values(dataQuestion); - EndCorrectAnswer = propertValuesObjectFromDb[1]; - - EndCacheId = propertValuesObjectFromDb[0]; - } + useEffect(() => { + fetch(`/random-question?fire-truck=${TruckId}`) + .then(res => res.json()) + .then(dataQuestion => { + if(isClick){ + const propertValuesObjectFromDb = Object.values(dataQuestion); + EndCorrectAnswer = propertValuesObjectFromDb[1]; + EndCacheId = propertValuesObjectFromDb[0]; + } - }) - }) + + }) + }); + @@ -30,7 +29,7 @@ const FetchData = ({isClick,score,setIsClick,setScore,navigate}) => {

{EndCorrectAnswer}

- +
@@ -40,7 +39,13 @@ const FetchData = ({isClick,score,setIsClick,setScore,navigate}) => { export const QuizGetQuestion = ({score,isClick,setScore,setIsClick,navigate}) => { return ( - + ) } \ No newline at end of file diff --git a/client/src/components/Result.jsx b/client/src/components/Result.jsx index 42cdefa..1535f7f 100644 --- a/client/src/components/Result.jsx +++ b/client/src/components/Result.jsx @@ -48,7 +48,7 @@ const Result = () => { textColor : 'black' , trailColor : '#c6c4c4' , backgroundColor : '#d42436' , - } ) } />; + } ) } />

{{endScore}/10 < 9 ? "Jesteś szybki.. ale pożar jest szybszy" : "Brawo udało ci się ugasić pożar !!!"}

diff --git a/client/src/components/Sound.jsx b/client/src/components/Sound.jsx deleted file mode 100644 index 5898c38..0000000 --- a/client/src/components/Sound.jsx +++ /dev/null @@ -1,6 +0,0 @@ -const Player = ({ url }) => { - const audio = new Audio(url); - const play = audio.play(); -}; - -export default Player; \ No newline at end of file