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 {operations["readBreadcrumb get /breadcrumb/{id}"]["response"]} breadcrumbs
*/
buildDynamicBreadcrumbs(
breadcrumbs: operations["readBreadcrumb get /breadcrumb/{id}"]["response"],
): Promise<void>;
/**
* Add a breadcrumb to the breadcrumbs list
*
* @param {Breadcrumb} breadcrumb
*/
pushBreadcrumb(breadcrumb: Breadcrumb): void;
};