Spaces:
Running
Running
add sound
Browse files- components/quizz/hooks/useQuizz.ts +3 -2
- public/lost.mp3 +0 -0
- public/success.mp3 +0 -0
components/quizz/hooks/useQuizz.ts
CHANGED
@@ -47,6 +47,9 @@ export const useQuizz = () => {
|
|
47 |
return (score ?? 0) + 1;
|
48 |
});
|
49 |
}
|
|
|
|
|
|
|
50 |
setResult(response.ok ? id : response.resultId, response?.ok);
|
51 |
await sleep(3000);
|
52 |
setResult(null);
|
@@ -69,8 +72,6 @@ export const useQuizz = () => {
|
|
69 |
});
|
70 |
|
71 |
const reset = () => {
|
72 |
-
client.setQueryData(['score'], 0);
|
73 |
-
client.setQueryData(['success'], null);
|
74 |
window.location.href = '/';
|
75 |
}
|
76 |
|
|
|
47 |
return (score ?? 0) + 1;
|
48 |
});
|
49 |
}
|
50 |
+
const sound = new Audio(response?.ok ? "/success.mp3" : "/lost.mp3");
|
51 |
+
sound.play();
|
52 |
+
|
53 |
setResult(response.ok ? id : response.resultId, response?.ok);
|
54 |
await sleep(3000);
|
55 |
setResult(null);
|
|
|
72 |
});
|
73 |
|
74 |
const reset = () => {
|
|
|
|
|
75 |
window.location.href = '/';
|
76 |
}
|
77 |
|
public/lost.mp3
ADDED
Binary file (25.9 kB). View file
|
|
public/success.mp3
ADDED
Binary file (67.2 kB). View file
|
|