diff --git a/server.ts b/server.ts index 59c6f37..c9b8085 100644 --- a/server.ts +++ b/server.ts @@ -2291,11 +2291,11 @@ app.post('/api/admin/reply-message', authenticateToken, requireAdmin, async (req if (cleanPhone.length >= 10) { const numberId = `${cleanPhone}@s.whatsapp.net`; const url = `${settings.evolutionApiUrl}/message/sendText/${settings.evolutionInstance}`; - await axios.post(url, { number: numberId, text: message, - options: { delay: 1200, linkPreview: true } + delay: 1200, + linkPreview: true }, { headers: { 'apikey': settings.evolutionApiKey, diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx index 456c4fe..c73ba56 100644 --- a/src/components/Navbar.tsx +++ b/src/components/Navbar.tsx @@ -47,7 +47,7 @@ export default function Navbar({ user, activeView, setView, onLogout, settings } try { // In a real app we would pass the token or it would be in cookies // Assuming server uses some auth, for demo we might just fetch - const token = localStorage.getItem('token'); + const token = localStorage.getItem('app_token') || localStorage.getItem('admin_token'); if (!token) return; const res = await fetch('/api/notifications', { headers: { 'Authorization': `Bearer ${token}` } @@ -63,7 +63,7 @@ export default function Navbar({ user, activeView, setView, onLogout, settings } const markAsRead = async (id: string) => { try { - const token = localStorage.getItem('token'); + const token = localStorage.getItem('app_token') || localStorage.getItem('admin_token'); if (!token) return; await fetch(`/api/notifications/${id}/read`, { method: 'PUT',