Skip to content
On this page

useCategorySearch ​

Definition ​

Composable for category search.

Basic usage ​

ts
const {  search, advancedSearch } = useCategorySearch();

Signature ​

ts
export function useCategorySearch(): UseCategorySearchReturn 

Return type ​

See UseCategorySearchReturn
ts
export type UseCategorySearchReturn = {
  /**
   * Search for category by ID
   * Accepts optional query params and associations
   */
  search(
    categoryId: string,
    options?: {
      withCmsAssociations?: boolean;
      query?: Schemas["Criteria"];
    },
  ): Promise<Schemas["Category"]>;

  /**
   * Search based on the query
   */
  advancedSearch(options: {
    withCmsAssociations?: boolean;
    query: Schemas["Criteria"];
  }): Promise<Schemas["Category"][]>;
};

Methods ​

NameTypeDescription
search
Promise<>
Search for category by IDAccepts optional query params and associations
advancedSearch
Promise<Array<>>
Search based on the query

Usage ​

ts
import { useCategorySearch } from "@shopware-pwa/composables-next";

const { search } = useCategorySearch();
useCategorySearch has loaded