fix(api): normalize empty list responses
This commit is contained in:
+2
-2
@@ -5,7 +5,7 @@ import type { Comment } from "@/lib/types"
|
||||
import { httpJson } from "./http"
|
||||
|
||||
type Paginated<T> = {
|
||||
items: T[]
|
||||
items: T[] | null
|
||||
meta: {
|
||||
total: number
|
||||
offset: number
|
||||
@@ -39,7 +39,7 @@ export async function listCommentsByPost(
|
||||
cache: "no-store",
|
||||
},
|
||||
)
|
||||
return res.items
|
||||
return res.items ?? []
|
||||
}
|
||||
|
||||
export async function addComment(postId: string, content: string) {
|
||||
|
||||
Reference in New Issue
Block a user