Skip to content

Commit 0cd254f

Browse files
feat: enable mark all inbox notifications as read (#17023)
Bind the "Mark all notifications as read" action to the correct API request in the UI.
1 parent 8d5e6f3 commit 0cd254f

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

site/src/api/api.ts

+4
Original file line numberDiff line numberDiff line change
@@ -2452,6 +2452,10 @@ class ApiMethods {
24522452
);
24532453
return res.data;
24542454
};
2455+
2456+
markAllInboxNotificationsAsRead = async () => {
2457+
await this.axios.put<void>("/api/v2/notifications/inbox/mark-all-as-read");
2458+
};
24552459
}
24562460

24572461
// This is a hard coded CSRF token/cookie pair for local development. In prod,

site/src/modules/dashboard/Navbar/NavbarView.tsx

+2-6
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@ export const NavbarView: FC<NavbarViewProps> = ({
6969

7070
<NotificationsInbox
7171
fetchNotifications={API.getInboxNotifications}
72-
markAllAsRead={() => {
73-
throw new Error("Function not implemented.");
74-
}}
72+
markAllAsRead={API.markAllInboxNotificationsAsRead}
7573
markNotificationAsRead={(notificationId) =>
7674
API.updateInboxNotificationReadStatus(notificationId, {
7775
is_read: true,
@@ -92,9 +90,7 @@ export const NavbarView: FC<NavbarViewProps> = ({
9290
<div className="ml-auto flex items-center gap-3 md:hidden">
9391
<NotificationsInbox
9492
fetchNotifications={API.getInboxNotifications}
95-
markAllAsRead={() => {
96-
throw new Error("Function not implemented.");
97-
}}
93+
markAllAsRead={API.markAllInboxNotificationsAsRead}
9894
markNotificationAsRead={(notificationId) =>
9995
API.updateInboxNotificationReadStatus(notificationId, {
10096
is_read: true,

0 commit comments

Comments
 (0)