Skip to main content

Interface: UseOrdersReturn

Defined in: composables/react/useOrders.ts:76

State and order actions returned by useOrders.

Properties

currentPage

currentPage: number

Defined in: composables/react/useOrders.ts:88

Current page number (1-based).


downloadPdf

downloadPdf: (order) => Promise<{ error?: string; success: boolean; }>

Defined in: composables/react/useOrders.ts:102

Downloads an order's confirmation PDF to the browser.

Parameters

order

Order

Returns

Promise<{ error?: string; success: boolean; }>


downloadQuotePdf

downloadQuotePdf: (orderId) => Promise<{ error?: string; success: boolean; }>

Defined in: composables/react/useOrders.ts:113

Downloads a quote PDF for the given order id.

Parameters

orderId

number

Returns

Promise<{ error?: string; success: boolean; }>


error

error: string | null

Defined in: composables/react/useOrders.ts:82

Last error message, or null.


fetchOrders

fetchOrders: (page?) => Promise<void>

Defined in: composables/react/useOrders.ts:96

Fetches a page of orders using the current search form.

Parameters

page?

number

Returns

Promise<void>


getOrderById

getOrderById: (orderId) => Promise<{ error?: string; order?: Order; success: boolean; }>

Defined in: composables/react/useOrders.ts:111

Fetches a single order by id.

Parameters

orderId

number

Returns

Promise<{ error?: string; order?: Order; success: boolean; }>


goToPage

goToPage: (page) => void

Defined in: composables/react/useOrders.ts:98

Navigates to a page.

Parameters

page

number

Returns

void


itemsPerPage

itemsPerPage: number

Defined in: composables/react/useOrders.ts:94

Page size.


loading

loading: boolean

Defined in: composables/react/useOrders.ts:80

true while a fetch is in flight.


orders

orders: Order[]

Defined in: composables/react/useOrders.ts:78

The current page of orders.


reorder

reorder: (order, cartId?) => Promise<{ cart?: Cart; error?: string; success: boolean; }>

Defined in: composables/react/useOrders.ts:104

Re-adds an order's items to a (new or existing) cart.

Parameters

order

Order

cartId?

string

Returns

Promise<{ cart?: Cart; error?: string; success: boolean; }>


resetSearch

resetSearch: () => void

Defined in: composables/react/useOrders.ts:100

Clears the search form and refetches page 1.

Returns

void


searchForm

searchForm: OrderSearchForm

Defined in: composables/react/useOrders.ts:84

The active search/filter criteria.


setQuoteStatus

setQuoteStatus: (orderId, flags) => Promise<{ error?: string; success: boolean; }>

Defined in: composables/react/useOrders.ts:106

Updates a quote/order status by id.

Parameters

orderId

number

flags
status?

string

Returns

Promise<{ error?: string; success: boolean; }>


setSearchForm

setSearchForm: (form) => void

Defined in: composables/react/useOrders.ts:86

Replaces the search criteria (does not trigger a fetch on its own).

Parameters

form

OrderSearchForm

Returns

void


totalItems

totalItems: number

Defined in: composables/react/useOrders.ts:92

Total matching orders across all pages.


totalPages

totalPages: number

Defined in: composables/react/useOrders.ts:90

Total number of pages.