Skip to content

Commit 13baa49

Browse files
committed
fix: satisfy the almighty typescript
1 parent a917741 commit 13baa49

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

src/app/api/collections/route.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,17 @@ export async function GET(request: NextRequest) {
1212

1313
const { offset } = Object.fromEntries(request.nextUrl.searchParams)
1414

15-
const [collections, count] = await productService.listAndCountCollections(
16-
{},
17-
{
18-
skip: parseInt(offset) || 0,
19-
take: 100,
20-
}
21-
)
15+
const [collections, count] = await productService
16+
.listAndCountCollections(
17+
{},
18+
{
19+
skip: parseInt(offset) || 0,
20+
take: 100,
21+
}
22+
)
23+
.catch((e) => {
24+
return notFound()
25+
})
2226

2327
return NextResponse.json({
2428
collections,

src/lib/data/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
import { Product, ProductCategory, ProductCollection } from "@medusajs/medusa"
21
import medusaRequest from "../medusa-fetch"
3-
import { StoreGetProductsParams } from "@medusajs/medusa"
2+
import {
3+
StoreGetProductsParams,
4+
Product,
5+
ProductCategory,
6+
ProductCollection,
7+
} from "@medusajs/medusa"
48
import { PricedProduct } from "@medusajs/medusa/dist/types/pricing"
59

610
export type ProductCategoryWithChildren = Omit<

src/modules/collections/templates/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { useInfiniteQuery } from "@tanstack/react-query"
1010
import { useCart } from "medusa-react"
1111
import React, { useEffect } from "react"
1212
import { useInView } from "react-intersection-observer"
13-
import { ProductCollection } from "@medusajs/product"
13+
import { ProductCollection } from "@medusajs/medusa"
1414

1515
const CollectionTemplate: React.FC<{ collection: ProductCollection }> = ({
1616
collection,

0 commit comments

Comments
 (0)