Refactir
This commit is contained in:
parent
ddacd8d6e3
commit
e81b31c9ee
@ -320,12 +320,12 @@ export class LeantimeAdapter implements NotificationAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Mark each notification as read
|
// Mark each notification as read
|
||||||
const markPromises = unreadNotifications.map(async (notification) => {
|
const markPromises = unreadNotifications.map(async (notification: { id: number | string; sourceId: string }) => {
|
||||||
// Use the ID directly (we already have it from the API response)
|
// Use the ID directly (we already have it from the API response)
|
||||||
const notificationId = typeof notification.id === 'number' ? notification.id : parseInt(String(notification.id || notification.sourceId));
|
const notificationId = typeof notification.id === 'number' ? notification.id : parseInt(String(notification.id || notification.sourceId));
|
||||||
|
|
||||||
if (isNaN(notificationId)) {
|
if (isNaN(notificationId)) {
|
||||||
console.error(`[LEANTIME_ADAPTER] markAllAsRead - Invalid notification ID: ${sourceId}`);
|
console.error(`[LEANTIME_ADAPTER] markAllAsRead - Invalid notification ID: ${notification.id || notification.sourceId}`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user