fix: usar número do WhatsApp correto direto sem puxar do banco

This commit is contained in:
Erik
2025-12-04 02:58:39 -03:00
parent d6ff6a61bc
commit 815a70bc41

View File

@@ -12,16 +12,10 @@ export default function WhatsAppButton() {
useEffect(() => { useEffect(() => {
setMounted(true); setMounted(true);
// Busca o número do WhatsApp das configurações // Usa o número padrão correto
fetch('/api/settings') // Se precisar atualizar no futuro, mude aqui
.then(res => res.json()) const defaultNumber = '553598829445';
.then(data => { setWhatsappLink(`https://api.whatsapp.com/send/?phone=${defaultNumber}&text&type=phone_number&app_absent=0`);
if (data.whatsapp) {
const cleanNumber = data.whatsapp.replace(/\D/g, '');
setWhatsappLink(`https://api.whatsapp.com/send/?phone=${cleanNumber}&text&type=phone_number&app_absent=0`);
}
})
.catch(console.error);
}, []); }, []);
if (!mounted) { if (!mounted) {