fix(api): normalize empty list responses

This commit is contained in:
zetaloop
2026-04-26 01:53:05 +08:00
parent 904148bd55
commit 30c336345e
11 changed files with 28 additions and 23 deletions
+2 -2
View File
@@ -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> {