uwu
This commit is contained in:
@@ -40,11 +40,16 @@ export default function ChatNotifications() {
|
||||
}
|
||||
});
|
||||
|
||||
// Get vendor info from profile endpoint - removing /api prefix
|
||||
const vendorResponse = await authAxios.get('/auth/me');
|
||||
|
||||
console.log(vendorResponse.data.vendor._id);
|
||||
|
||||
const vendorId = vendorResponse.data.vendor._id;
|
||||
|
||||
// Access correct property - the vendor ID is in vendor._id
|
||||
const vendorId = vendorResponse.data.vendor?._id;
|
||||
|
||||
if (!vendorId) {
|
||||
console.error("Vendor ID not found in profile response:", vendorResponse.data);
|
||||
return;
|
||||
}
|
||||
|
||||
const response = await authAxios.get(`/chats/vendor/${vendorId}/unread`);
|
||||
setUnreadCounts(response.data);
|
||||
@@ -56,11 +61,11 @@ export default function ChatNotifications() {
|
||||
// Create a simplified metadata object with just needed info
|
||||
const metadata: Record<string, { buyerId: string }> = {};
|
||||
|
||||
// Fetch each chat to get buyer IDs
|
||||
// Fetch each chat to get buyer IDs - removing /api prefix
|
||||
await Promise.all(
|
||||
chatIds.map(async (chatId) => {
|
||||
try {
|
||||
const chatResponse = await authAxios.get(`/api/chats/${chatId}`);
|
||||
const chatResponse = await authAxios.get(`/chats/${chatId}`);
|
||||
metadata[chatId] = {
|
||||
buyerId: chatResponse.data.buyerId,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user