useBreadcrumbs
Category:
CMS (Shopping Experiences)
Composable for breadcrumbs management. Read the guide.
Types
ts
export function useBreadcrumbs(
newBreadcrumbs?: Breadcrumb[],
): UseBreadcrumbsReturn
ts
export type Breadcrumb =
| {
name: string;
path?: string;
}
| Schemas["Breadcrumb"];
ts
export type UseBreadcrumbsReturn = {
/**
* Clear breadcrumbs store
*/
clearBreadcrumbs(): void;
/**
* List of breadcrumbs
*/
breadcrumbs: ComputedRef<Breadcrumb[]>;
/**
* Get category breadcrumbs from the API
*
* @param {string} categoryId
* @returns
*/
getCategoryBreadcrumbs: (
categoryId: string,
) => Promise<operations["readBreadcrumb get /breadcrumb/{id}"]["response"]>;
/**
* Build breadcrumbs dynamically for a category by fetching them from the API
*
* @param {string} categoryId
*/
buildDynamicBreadcrumbs(categoryId: string): Promise<void>;
};