slug fix
This commit is contained in:
@@ -47,12 +47,11 @@ export function categoryDisplayName(name, categoryId, rootCategoryId) {
|
||||
return name?.trim() || '';
|
||||
}
|
||||
|
||||
export function categorySlug(name, categoryId, rootCategoryId) {
|
||||
if (rootCategoryId != null && String(categoryId) === String(rootCategoryId)) {
|
||||
export function categorySlug(node, rootCategoryId) {
|
||||
if (rootCategoryId != null && String(node.id) === String(rootCategoryId)) {
|
||||
return ROOT_CATEGORY_NAME;
|
||||
}
|
||||
const trimmed = name?.trim();
|
||||
return trimmed || null;
|
||||
return node.slug || null;
|
||||
}
|
||||
|
||||
export function normalizeCategoryMap(data, companyRootCategoryId) {
|
||||
@@ -82,7 +81,7 @@ export function getCategoryBreadcrumbs(categories, currentCategoryId, rootCatego
|
||||
crumbs.unshift({
|
||||
id: node.id,
|
||||
name: categoryDisplayName(node.name, node.id, rootCategoryId),
|
||||
slug: categorySlug(node.name, node.id, rootCategoryId),
|
||||
slug: categorySlug(node, rootCategoryId),
|
||||
});
|
||||
|
||||
const parentId = node.parentId;
|
||||
|
||||
Reference in New Issue
Block a user