diff --git a/packages/bigcommerce/src/lib/normalize.ts b/packages/bigcommerce/src/lib/normalize.ts index dcad0d207..e83394c91 100644 --- a/packages/bigcommerce/src/lib/normalize.ts +++ b/packages/bigcommerce/src/lib/normalize.ts @@ -128,10 +128,12 @@ export function normalizeCategory(category: BCCategory): Category { } export function normalizeBrand(brand: BCBrand): Brand { + const path = brand.node.path.replace('/brands/', '') + const slug = getSlug(path) return { id: `${brand.node.entityId}`, name: brand.node.name, - slug: getSlug(brand.node.path), - path: brand.node.path, + slug, + path: `/${slug}`, } } diff --git a/packages/bigcommerce/src/product/use-search.tsx b/packages/bigcommerce/src/product/use-search.tsx index 7e7dcbbfe..038fc9b7f 100644 --- a/packages/bigcommerce/src/product/use-search.tsx +++ b/packages/bigcommerce/src/product/use-search.tsx @@ -6,8 +6,8 @@ export default useSearch as UseSearch export type SearchProductsInput = { search?: string - categoryId?: number | string - brandId?: number + categoryId?: string + brandId?: string sort?: string locale?: string } @@ -24,7 +24,7 @@ export const handler: SWRHook = { if (search) url.searchParams.set('search', search) if (Number.isInteger(Number(categoryId))) url.searchParams.set('categoryId', String(categoryId)) - if (Number.isInteger(brandId)) + if (Number.isInteger(Number(brandId))) url.searchParams.set('brandId', String(brandId)) if (sort) url.searchParams.set('sort', sort) diff --git a/site/components/search.tsx b/site/components/search.tsx index 5f8628606..92146628c 100644 --- a/site/components/search.tsx +++ b/site/components/search.tsx @@ -49,7 +49,7 @@ export default function Search({ categories, brands }: SearchPropsType) { const { data, error } = useSearch({ search: typeof q === 'string' ? q : '', categoryId: activeCategory?.id, - brandId: (activeBrand as any)?.id, + brandId: activeBrand?.id, sort: typeof sort === 'string' ? sort : '', locale, })