* Dismiss a specific notification * @param {number} notificationId - The notification ID to dismiss * @param {string} actionTaken - Optional action taken (e.g., 'applied', 'ignored')
(notificationId, actionTaken = null)
| 3721 | * @param {string} actionTaken - Optional action taken (e.g., 'applied', 'ignored') |
| 3722 | */ |
| 3723 | static async dismissNotification(notificationId, actionTaken = null) { |
| 3724 | try { |
| 3725 | const body = {}; |
| 3726 | if (actionTaken) { |
| 3727 | body.action_taken = actionTaken; |
| 3728 | } |
| 3729 | |
| 3730 | const response = await request( |
| 3731 | `${host}/api/core/notifications/${notificationId}/dismiss/`, |
| 3732 | { |
| 3733 | method: 'POST', |
| 3734 | body, |
| 3735 | } |
| 3736 | ); |
| 3737 | |
| 3738 | // Update the store |
| 3739 | const { default: useNotificationsStore } = |
| 3740 | await import('./store/notifications'); |
| 3741 | useNotificationsStore |
| 3742 | .getState() |
| 3743 | .dismissNotification(response.notification_key); |
| 3744 | |
| 3745 | return response; |
| 3746 | } catch (e) { |
| 3747 | errorNotification('Failed to dismiss notification', e); |
| 3748 | } |
| 3749 | } |
| 3750 | |
| 3751 | // Dismiss all notifications |
| 3752 | static async dismissAllNotifications() { |
no test coverage detected