fix(api): normalize empty list responses
This commit is contained in:
+2
-2
@@ -5,7 +5,7 @@ import type { Order, OrderStatus } from "@/lib/types"
|
||||
import { httpJson } from "./http"
|
||||
|
||||
type Paginated<T> = {
|
||||
items: T[]
|
||||
items: T[] | null
|
||||
meta: {
|
||||
total: number
|
||||
offset: number
|
||||
@@ -59,7 +59,7 @@ export async function listOrders(options?: ListOrdersOptions): Promise<Order[]>
|
||||
const res = await httpJson<Paginated<Order>>(withOffsetLimit("/api/v1/orders", options), {
|
||||
cache: "no-store",
|
||||
})
|
||||
return res.items
|
||||
return res.items ?? []
|
||||
}
|
||||
|
||||
export async function getOrderById(orderId: string): Promise<Order | undefined> {
|
||||
|
||||
Reference in New Issue
Block a user