Skip to content
On this page

useCustomerOrders ​

Definition ​

Composable for fetching the orders list.

Basic usage ​

ts
const { 
 orders,
 getCurrentPage,
 getTotalPagesCount,
 changeCurrentPage,
 loadOrders 
} = useCustomerOrders();

Signature ​

ts
export function useCustomerOrders(): UseCustomerOrdersReturn 

Return type ​

See UseCustomerOrdersReturn
ts
export type UseCustomerOrdersReturn = {
  /**
   * All placed orders belonging to the logged-in customer
   */
  orders: Ref<Schemas["Order"][]>;
  /**
   * Changes the current page of the orders list
   *
   * In order to change a page with additional parameters please use `loadOrders` method.
   */
  changeCurrentPage(
    pageNumber: number | string,
    limit: number | string,
  ): Promise<void>;
  /**
   * Fetches the orders list and assigns the result to the `orders` property
   */
  loadOrders(parameters?: Schemas["Criteria"]): Promise<void>;
  /**
   * Current page number
   */
  getCurrentPage: ComputedRef<number>;
  /**
   * total pages count
   */
  getTotalPagesCount: ComputedRef<number>;
};

Properties ​

NameTypeDescription
orders
Ref<Array<>>
All placed orders belonging to the logged-in customer
getCurrentPage
ComputedRef<number>
Current page number
getTotalPagesCount
ComputedRef<number>
total pages count

Methods ​

NameTypeDescription
changeCurrentPage
Promise<void>
Changes the current page of the orders listIn order to change a page with additional parameters please use `loadOrders` method.
loadOrders
Promise<void>
Fetches the orders list and assigns the result to the `orders` property
useCustomerOrders has loaded