* Get all active notifications for the current user * @param {boolean} includeDismissed - Whether to include already dismissed notifications
(includeDismissed = false)
| 3677 | * @param {boolean} includeDismissed - Whether to include already dismissed notifications |
| 3678 | */ |
| 3679 | static async getNotifications(includeDismissed = false) { |
| 3680 | try { |
| 3681 | const params = new URLSearchParams(); |
| 3682 | if (includeDismissed) { |
| 3683 | params.append('include_dismissed', 'true'); |
| 3684 | } |
| 3685 | const response = await request( |
| 3686 | `${host}/api/core/notifications/?${params.toString()}` |
| 3687 | ); |
| 3688 | |
| 3689 | // Update the store with fetched notifications |
| 3690 | const { default: useNotificationsStore } = |
| 3691 | await import('./store/notifications'); |
| 3692 | useNotificationsStore.getState().setNotifications(response.notifications); |
| 3693 | |
| 3694 | return response; |
| 3695 | } catch (e) { |
| 3696 | errorNotification('Failed to retrieve notifications', e); |
| 3697 | } |
| 3698 | } |
| 3699 | |
| 3700 | // Get unread notification count |
| 3701 | static async getNotificationCount() { |
no test coverage detected