fix(api): normalize empty list responses
This commit is contained in:
@@ -3,7 +3,7 @@ import type { Notification } from "@/lib/types"
|
||||
import { httpJson } from "./http"
|
||||
|
||||
type Paginated<T> = {
|
||||
items: T[]
|
||||
items: T[] | null
|
||||
meta: {
|
||||
total: number
|
||||
offset: number
|
||||
@@ -26,7 +26,7 @@ export async function listNotifications(input?: {
|
||||
const res = await httpJson<Paginated<Notification>>(`/api/v1/notifications?${searchParams}`, {
|
||||
cache: "no-store",
|
||||
})
|
||||
return res.items
|
||||
return res.items ?? []
|
||||
}
|
||||
|
||||
export async function markNotificationAsRead(notificationId: string): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user