From 3282051671133c6c71fe02cd2d25d9d5acf17828 Mon Sep 17 00:00:00 2001 From: NotII <46204250+NotII@users.noreply.github.com> Date: Mon, 3 Mar 2025 21:21:54 +0000 Subject: [PATCH] Update ChatNotifications.tsx --- components/dashboard/ChatNotifications.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/components/dashboard/ChatNotifications.tsx b/components/dashboard/ChatNotifications.tsx index be53b76..c17a640 100644 --- a/components/dashboard/ChatNotifications.tsx +++ b/components/dashboard/ChatNotifications.tsx @@ -29,12 +29,10 @@ export default function ChatNotifications() { useEffect(() => { const fetchUnreadCounts = async () => { try { - // Get auth token from cookies const authToken = getCookie("Authorization"); if (!authToken) return; - // Set up axios with the auth token const authAxios = axios.create({ baseURL: process.env.NEXT_PUBLIC_API_URL, headers: { @@ -42,15 +40,15 @@ export default function ChatNotifications() { } }); - // Get vendor ID from profile const vendorResponse = await authAxios.get('/auth/me'); + console.log(vendorResponse.data.vendor._id); + const vendorId = vendorResponse.data.vendor._id; const response = await authAxios.get(`/chats/vendor/${vendorId}/unread`); setUnreadCounts(response.data); - // If there are unread messages, fetch chat metadata if (response.data.totalUnread > 0) { const chatIds = Object.keys(response.data.chatCounts);