Skip to Content
Documentation
Starter kits
Get Pro
Introduction
Installation

Notifications router

An overview of the Notifications router

Procedures

The notifications router has the following procedures:

Get the notifications inbox

Returns all the notifications for the current user.

// Client components
const { data } = useQuery(trpc.notifications.inbox.queryOptions())

// Server components
const data = await caller.notifications.inbox()

Mark a notification as read

Marks a notification as read.

  • Access: @protected
// Client components
const { mutate } = useMutation(
  trpc.notifications.markAsRead.mutationOptions({
    notificationId: 'notification-id',
  }),
)

// Server components
const data = await caller.notifications.markAsRead({
  notificationId: 'notification-id',
})
Notifications router