From e6eb13c9d0260ae6d9cc405e54b6ea27dedac8dd Mon Sep 17 00:00:00 2001
From: zwlucas <lucas.oliveira1676@etec.sp.gov.br>
Date: Tue, 1 Apr 2025 09:26:32 -0300
Subject: new sounds

---
 app/obrigado/page.tsx | 9 +++++++++
 1 file changed, 9 insertions(+)

(limited to 'app/obrigado/page.tsx')

diff --git a/app/obrigado/page.tsx b/app/obrigado/page.tsx
index 7234012..c5d3bc5 100644
--- a/app/obrigado/page.tsx
+++ b/app/obrigado/page.tsx
@@ -27,12 +27,19 @@ export default function ObrigadoPage() {
 
   const hasRun = useRef(false);
 
+  const [audioElement, setAudioElement] = useState<HTMLAudioElement>()
+
   useEffect(() => {
     if (!rm || !name || !cpf || !option) {
       window.location.href = "/";
       return;
     }
 
+    if (!audioElement) {
+      const audio = new Audio('/confirma.mp3')
+      setAudioElement(audio)
+    }
+
     const saveVote = async () => {
       try {
         const supabase = getSupabaseClient();
@@ -63,6 +70,8 @@ export default function ObrigadoPage() {
         }
 
         setSaveStatus("success");
+        if (!audioElement) return;
+        audioElement.play();
       } catch (error) {
         console.error("Erro ao salvar voto:", error);
         setSaveStatus("error");
-- 
cgit v1.2.3

