clean things up like console.log

This commit is contained in:
Oliver Heywood
2021-10-11 10:13:46 -05:00
parent b03e6f0271
commit 517466c313
2 changed files with 4 additions and 18 deletions

View File

@@ -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')

View File

@@ -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,