This commit is contained in:
NotII
2025-03-03 21:20:58 +00:00
parent f5382d82f6
commit 2fafcb868a
7 changed files with 48 additions and 35 deletions

View File

@@ -42,8 +42,10 @@ export default function ChatNotifications() {
}
});
// Get vendor ID (placeholder until proper JWT decoding)
const vendorId = "current"; // Replace with actual ID extraction
// Get vendor ID from profile
const vendorResponse = await authAxios.get('/auth/me');
const vendorId = vendorResponse.data.vendor._id;
const response = await authAxios.get(`/chats/vendor/${vendorId}/unread`);
setUnreadCounts(response.data);
@@ -60,7 +62,7 @@ export default function ChatNotifications() {
await Promise.all(
chatIds.map(async (chatId) => {
try {
const chatResponse = await authAxios.get(`/chats/${chatId}`);
const chatResponse = await authAxios.get(`/api/chats/${chatId}`);
metadata[chatId] = {
buyerId: chatResponse.data.buyerId,
};