mirror of
https://github.com/vercel/commerce.git
synced 2025-07-23 04:36:49 +00:00
clean things up like console.log
This commit is contained in:
@@ -17,8 +17,6 @@ const getProducts: ProductsEndpoint['handlers']['getProducts'] = async ({
|
|||||||
body: { search, categoryId, brandId, sort },
|
body: { search, categoryId, brandId, sort },
|
||||||
config: { restBuyerFetch, cartCookie, tokenCookie },
|
config: { restBuyerFetch, cartCookie, tokenCookie },
|
||||||
}) => {
|
}) => {
|
||||||
console.log("categoryId", categoryId)
|
|
||||||
|
|
||||||
//Use a dummy base as we only care about the relative path
|
//Use a dummy base as we only care about the relative path
|
||||||
const url = new URL('/me/products', 'http://a')
|
const url = new URL('/me/products', 'http://a')
|
||||||
|
|
||||||
|
@@ -10,24 +10,12 @@ export const handler: SWRHook<SearchProductsHook> = {
|
|||||||
},
|
},
|
||||||
fetcher({ input: { search, categoryId, brandId, sort }, options, fetch }) {
|
fetcher({ input: { search, categoryId, brandId, sort }, options, fetch }) {
|
||||||
// Use a dummy base as we only care about the relative path
|
// Use a dummy base as we only care about the relative path
|
||||||
console.log("url:", options.url);
|
|
||||||
|
|
||||||
const url = new URL(options.url!, 'http://a')
|
const url = new URL(options.url!, 'http://a')
|
||||||
|
|
||||||
if (search) {
|
url.searchParams.set('search', String(search))
|
||||||
url.searchParams.set('search', search)
|
url.searchParams.set('categoryId', String(categoryId))
|
||||||
}
|
url.searchParams.set('brandId', String(brandId))
|
||||||
if (categoryId) {
|
url.searchParams.set('sort', String(sort))
|
||||||
url.searchParams.set('categoryId', String(categoryId))
|
|
||||||
}
|
|
||||||
if (brandId) {
|
|
||||||
url.searchParams.set('brandId', String(brandId))
|
|
||||||
}
|
|
||||||
if (sort) {
|
|
||||||
url.searchParams.set('sort', String(sort))
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log("url:", url.pathname + url.search);
|
|
||||||
|
|
||||||
return fetch({
|
return fetch({
|
||||||
url: url.pathname + url.search,
|
url: url.pathname + url.search,
|
||||||
|
Reference in New Issue
Block a user