@websolutespa/payload-plugin-bowl
Version:
Bowl PayloadCms plugin of the BOM Repository
25 lines (24 loc) • 858 B
JavaScript
export async function decorateHref_(item, slug, context) {
// console.log('decorateHref_');
const { market, locale, routes } = context;
const route = routes.find((x)=>x.schema === slug && x.page === item.id && x.market === market && x.locale === locale);
const href = route ? route.id : null;
return {
...item,
href
};
}
export async function decorateHrefs_(items, slug, context) {
// console.log('decorateHrefs_');
const { market, locale } = context;
const routes = context.routes.filter((x)=>x.schema === slug && x.market === market && x.locale === locale);
return items.map((item)=>{
const route = routes.find((x)=>x.page === item.id);
const href = route ? route.id : null;
return {
...item,
href
};
});
}
//# sourceMappingURL=href.js.map