feat(admin-ui): Phase B frontend — notifications preferences route + UI
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
||||
type CascadePlan,
|
||||
type ChangelogDiff,
|
||||
type ChangelogResponse,
|
||||
type NotificationPreferences,
|
||||
type NotificationsResponse,
|
||||
type SchemaDraft,
|
||||
type SchemaReviewQueuePage,
|
||||
@@ -851,3 +852,23 @@ export const myNotificationsQuery = (unreadOnly = false, limit = 20) =>
|
||||
|
||||
export const useMyNotifications = (unreadOnly = false, limit = 20) =>
|
||||
useQuery(myNotificationsQuery(unreadOnly, limit))
|
||||
|
||||
/**
|
||||
* Phase B — per-channel notification preferences для current user. GET — single
|
||||
* row (no pagination), 401 если anonymous. Default semantics filled in
|
||||
* backend-side когда DB row missing (email=true / express=false / telegram=false).
|
||||
*/
|
||||
export const myNotificationPreferencesQuery = () =>
|
||||
queryOptions({
|
||||
queryKey: ['notifications', 'me', 'preferences'] as const,
|
||||
queryFn: async (): Promise<NotificationPreferences> => {
|
||||
const { data } = await apiClient.get<NotificationPreferences>(
|
||||
'/me/notifications/preferences',
|
||||
)
|
||||
return data
|
||||
},
|
||||
staleTime: 60_000, // prefs не меняются часто, кэш дольше
|
||||
})
|
||||
|
||||
export const useMyNotificationPreferences = () =>
|
||||
useQuery(myNotificationPreferencesQuery())
|
||||
|
||||
Reference in New Issue
Block a user