fix: usar número do WhatsApp correto direto sem puxar do banco
This commit is contained in:
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user