mirror of
https://github.com/coder/coder.git
synced 2026-09-21 20:51:01 +08:00
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.
This commit is contained in:
@@ -2452,6 +2452,10 @@ class ApiMethods {
|
||||
);
|
||||
return res.data;
|
||||
};
|
||||
|
||||
markAllInboxNotificationsAsRead = async () => {
|
||||
await this.axios.put<void>("/api/v2/notifications/inbox/mark-all-as-read");
|
||||
};
|
||||
}
|
||||
|
||||
// This is a hard coded CSRF token/cookie pair for local development. In prod,
|
||||
|
||||
@@ -69,9 +69,7 @@ export const NavbarView: FC<NavbarViewProps> = ({
|
||||
|
||||
<NotificationsInbox
|
||||
fetchNotifications={API.getInboxNotifications}
|
||||
markAllAsRead={() => {
|
||||
throw new Error("Function not implemented.");
|
||||
}}
|
||||
markAllAsRead={API.markAllInboxNotificationsAsRead}
|
||||
markNotificationAsRead={(notificationId) =>
|
||||
API.updateInboxNotificationReadStatus(notificationId, {
|
||||
is_read: true,
|
||||
@@ -92,9 +90,7 @@ export const NavbarView: FC<NavbarViewProps> = ({
|
||||
<div className="ml-auto flex items-center gap-3 md:hidden">
|
||||
<NotificationsInbox
|
||||
fetchNotifications={API.getInboxNotifications}
|
||||
markAllAsRead={() => {
|
||||
throw new Error("Function not implemented.");
|
||||
}}
|
||||
markAllAsRead={API.markAllInboxNotificationsAsRead}
|
||||
markNotificationAsRead={(notificationId) =>
|
||||
API.updateInboxNotificationReadStatus(notificationId, {
|
||||
is_read: true,
|
||||
|
||||
Reference in New Issue
Block a user