()
| 81 | } |
| 82 | |
| 83 | export function useNotifications() { |
| 84 | const currentUser = useCurrentUser(); |
| 85 | |
| 86 | return useQuery({ |
| 87 | queryKey: userKeys.notifications(), |
| 88 | queryFn: async () => { |
| 89 | if (!currentUser?.name) { |
| 90 | return []; |
| 91 | } |
| 92 | const { notifications } = await userServiceClient.listUserNotifications({ parent: currentUser.name }); |
| 93 | return notifications; |
| 94 | }, |
| 95 | enabled: !!currentUser?.name, |
| 96 | staleTime: 1000 * 30, // 30 seconds - notifications should update frequently |
| 97 | }); |
| 98 | } |
| 99 | |
| 100 | export function useTagCounts(forCurrentUser = false) { |
| 101 | const currentUser = useCurrentUser(); |
no test coverage detected