Skip to content

Commit 3d6a460

Browse files
committed
feat: core support, minor fixes
1 parent 01d32b2 commit 3d6a460

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

src/app/(main)/[category]/[subcategory]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export async function generateMetadata({ params }: Props): Promise<Metadata> {
2121

2222
return {
2323
title: `${category.name} | Acme Store`,
24-
description: `${category.name} collection`,
24+
description: `${category.name} category`,
2525
}
2626
}
2727

src/lib/data/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,15 +260,18 @@ export async function getCategoryByHandle(handle: string) {
260260
DEBUG && console.log("PRODUCT_MODULE_DISABLED")
261261
const data = await medusaRequest("GET", "/product-categories", {
262262
query: {
263-
handle: handle,
263+
handle,
264264
},
265265
})
266266
.then((res) => res.body)
267267
.catch((err) => {
268268
throw err
269269
})
270270

271-
return data
271+
return {
272+
product_categories: data.product_categories,
273+
parent: data.product_categories[0].parent_category,
274+
}
272275
}
273276

274277
/**

src/modules/categories/templates/index.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ type CategoryTemplateProps = {
1818
handle: string
1919
name: string
2020
id: string
21+
description?: string
2122
category_children?: {
2223
name: string
2324
handle: string
@@ -92,6 +93,11 @@ const CategoryTemplate: React.FC<CategoryTemplateProps> = ({
9293
)}
9394
<h1>{category.name}</h1>
9495
</div>
96+
{category.description && (
97+
<div className="mb-8 text-base-regular">
98+
<p>{category.description}</p>
99+
</div>
100+
)}
95101
{category.category_children && (
96102
<div className="mb-8 text-base-large">
97103
<ul className="grid grid-cols-1 gap-2">

0 commit comments

Comments
 (0)