fix: conserta token de auth nas notificacoes e payload do evolution api v2
Build and Deploy (Gitea) / build-and-deploy (push) Successful in 1m6s Details

This commit is contained in:
Sidney Gomes 2026-07-24 19:16:35 -03:00
parent 9efcf4f4b1
commit 85eb68c771
2 changed files with 4 additions and 4 deletions

View File

@ -2291,11 +2291,11 @@ app.post('/api/admin/reply-message', authenticateToken, requireAdmin, async (req
if (cleanPhone.length >= 10) { if (cleanPhone.length >= 10) {
const numberId = `${cleanPhone}@s.whatsapp.net`; const numberId = `${cleanPhone}@s.whatsapp.net`;
const url = `${settings.evolutionApiUrl}/message/sendText/${settings.evolutionInstance}`; const url = `${settings.evolutionApiUrl}/message/sendText/${settings.evolutionInstance}`;
await axios.post(url, { await axios.post(url, {
number: numberId, number: numberId,
text: message, text: message,
options: { delay: 1200, linkPreview: true } delay: 1200,
linkPreview: true
}, { }, {
headers: { headers: {
'apikey': settings.evolutionApiKey, 'apikey': settings.evolutionApiKey,

View File

@ -47,7 +47,7 @@ export default function Navbar({ user, activeView, setView, onLogout, settings }
try { try {
// In a real app we would pass the token or it would be in cookies // 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 // 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; if (!token) return;
const res = await fetch('/api/notifications', { const res = await fetch('/api/notifications', {
headers: { 'Authorization': `Bearer ${token}` } headers: { 'Authorization': `Bearer ${token}` }
@ -63,7 +63,7 @@ export default function Navbar({ user, activeView, setView, onLogout, settings }
const markAsRead = async (id: string) => { const markAsRead = async (id: string) => {
try { try {
const token = localStorage.getItem('token'); const token = localStorage.getItem('app_token') || localStorage.getItem('admin_token');
if (!token) return; if (!token) return;
await fetch(`/api/notifications/${id}/read`, { await fetch(`/api/notifications/${id}/read`, {
method: 'PUT', method: 'PUT',