Skip to content

Commit 31b2f6e

Browse files
committed
fix: cleanup
1 parent 2532a4e commit 31b2f6e

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/app/collections/route.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@ import { NextRequest, NextResponse } from "next/server"
44
export const runtime = "edge"
55

66
export async function GET(request: NextRequest) {
7-
const searchParams = request.nextUrl.searchParams
8-
const handle = searchParams.get("handle") ?? ""
9-
const pageParam = searchParams.get("pageParam") ?? "0"
10-
const limit = searchParams.get("limit") ?? "12"
11-
const cart_id = searchParams.get("cart_id") ?? ""
7+
const searchParams = Object.fromEntries(request.nextUrl.searchParams)
8+
const { handle, pageParam, limit, cart_id } = searchParams
129

1310
const collection = await fetchCollection(handle)
1411
.then((res) => res)
@@ -44,9 +41,9 @@ async function fetchCollection(handle: string) {
4441
}
4542

4643
async function fetchCollectionProducts({
47-
pageParam,
44+
pageParam = "0",
4845
id,
49-
limit,
46+
limit = "12",
5047
cart_id,
5148
}: {
5249
pageParam: string

src/lib/context/product-context.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import React, {
1111
useMemo,
1212
useState,
1313
} from "react"
14-
import { Product, Variant } from "types/medusa"
14+
import { Variant } from "types/medusa"
1515
import { useStore } from "./store-context"
1616
import { PricedProduct } from "@medusajs/medusa/dist/types/pricing"
1717

0 commit comments

Comments
 (0)