Update orders flow
This commit is contained in:
@@ -3,9 +3,9 @@ import type {
|
||||
PaginatedResponse,
|
||||
SaleResponse,
|
||||
OrderResponse,
|
||||
OrderStatus,
|
||||
PaymentResponse,
|
||||
SaleStatus,
|
||||
OrderStatus,
|
||||
PaymentStatus,
|
||||
PaymentMethod,
|
||||
} from '@/types/api'
|
||||
@@ -54,20 +54,21 @@ export const sales = {
|
||||
}
|
||||
|
||||
// ─── Orders ───────────────────────────────────────────────────────────────────
|
||||
|
||||
export interface OrderListParams extends PageParams {
|
||||
storeId?: string
|
||||
status?: OrderStatus
|
||||
from?: string
|
||||
to?: string
|
||||
}
|
||||
// GET /orders takes no query params and returns a plain array — no server-side
|
||||
// filtering/pagination exists on the backend, unlike Sales/Payments.
|
||||
|
||||
export const orders = {
|
||||
list: (params?: OrderListParams) =>
|
||||
api.get<PaginatedResponse<OrderResponse>>('/orders', { params }).then(r => r.data),
|
||||
list: () =>
|
||||
api.get<OrderResponse[]>('/orders').then(r => r.data),
|
||||
|
||||
get: (id: string) =>
|
||||
api.get<OrderResponse>(`/orders/${id}`).then(r => r.data),
|
||||
|
||||
update: (id: string, status: OrderStatus) =>
|
||||
api.put<OrderResponse>(`/orders/${id}`, { status }).then(r => r.data),
|
||||
|
||||
delete: (id: string) =>
|
||||
api.delete(`/orders/${id}`),
|
||||
}
|
||||
|
||||
// ─── Payments ─────────────────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user