Skip to content

Commit 8175704

Browse files
committed
fix: logs cleanup
1 parent 2cda229 commit 8175704

File tree

2 files changed

+0
-21
lines changed

2 files changed

+0
-21
lines changed

src/lib/data/index.ts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ const PRODUCT_MODULE_ENABLED =
2626
// The API_BASE_URL is set in the .env file. It is the base URL of your Next.js app.
2727
const API_BASE_URL = process.env.NEXT_PUBLIC_BASE_URL || "http://localhost:8000"
2828

29-
// Set DEBUG to true to console.log where the data is coming from.
30-
const DEBUG = false
31-
3229
/**
3330
* Fetches a product by handle, using the Medusa API or the Medusa Product Module, depending on the feature flag.
3431
* @param handle (string) - The handle of the product to retrieve
@@ -38,7 +35,6 @@ export async function getProductByHandle(
3835
handle: string
3936
): Promise<{ products: PricedProduct[] }> {
4037
if (PRODUCT_MODULE_ENABLED) {
41-
DEBUG && console.log("PRODUCT_MODULE_ENABLED")
4238
const data = await fetch(`${API_BASE_URL}/api/products/${handle}`)
4339
.then((res) => res.json())
4440
.catch((err) => {
@@ -48,7 +44,6 @@ export async function getProductByHandle(
4844
return data
4945
}
5046

51-
DEBUG && console.log("PRODUCT_MODULE_DISABLED")
5247
const { products } = await medusaRequest("GET", "/products", {
5348
query: {
5449
handle,
@@ -84,7 +79,6 @@ export async function getProductsList({
8479
const limit = queryParams.limit || 12
8580

8681
if (PRODUCT_MODULE_ENABLED) {
87-
DEBUG && console.log("PRODUCT_MODULE_ENABLED")
8882
const params = new URLSearchParams(queryParams as Record<string, string>)
8983

9084
const { products, count, nextPage } = await fetch(
@@ -102,7 +96,6 @@ export async function getProductsList({
10296
}
10397
}
10498

105-
DEBUG && console.log("PRODUCT_MODULE_DISABLED")
10699
const { products, count, nextPage } = await medusaRequest(
107100
"GET",
108101
"/products",
@@ -135,7 +128,6 @@ export async function getCollectionsList(
135128
offset: number = 0
136129
): Promise<{ collections: ProductCollection[]; count: number }> {
137130
if (PRODUCT_MODULE_ENABLED) {
138-
DEBUG && console.log("PRODUCT_MODULE_ENABLED")
139131
const { collections, count } = await fetch(
140132
`${API_BASE_URL}/api/collections?offset=${offset}`,
141133
{
@@ -155,7 +147,6 @@ export async function getCollectionsList(
155147
}
156148
}
157149

158-
DEBUG && console.log("PRODUCT_MODULE_DISABLED")
159150
const { collections, count } = await medusaRequest("GET", "/collections", {
160151
query: {
161152
offset,
@@ -185,7 +176,6 @@ export async function getCollectionByHandle(handle: string): Promise<{
185176
nextPage: number
186177
}> {
187178
if (PRODUCT_MODULE_ENABLED) {
188-
DEBUG && console.log("PRODUCT_MODULE_ENABLED")
189179
const data = await fetch(`${API_BASE_URL}/api/collections/${handle}`)
190180
.then((res) => res.json())
191181
.catch((err) => {
@@ -195,7 +185,6 @@ export async function getCollectionByHandle(handle: string): Promise<{
195185
return data
196186
}
197187

198-
DEBUG && console.log("PRODUCT_MODULE_DISABLED")
199188
const data = await medusaRequest("GET", "/collections", {
200189
query: {
201190
handle: [handle],
@@ -232,7 +221,6 @@ export async function getProductsByCollectionHandle({
232221
nextPage: number
233222
}> {
234223
if (PRODUCT_MODULE_ENABLED) {
235-
DEBUG && console.log("PRODUCT_MODULE_ENABLED")
236224
const { response, nextPage } = await fetch(
237225
`${API_BASE_URL}/api/collections/${handle}?currency_code=${currencyCode}&page=${pageParam.toString()}`
238226
)
@@ -247,7 +235,6 @@ export async function getProductsByCollectionHandle({
247235
}
248236
}
249237

250-
DEBUG && console.log("PRODUCT_MODULE_DISABLED")
251238
const { id } = await getCollectionByHandle(handle).then(
252239
(res) => res.collections[0]
253240
)
@@ -283,7 +270,6 @@ export async function getCategoriesList(
283270
count: number
284271
}> {
285272
if (PRODUCT_MODULE_ENABLED) {
286-
DEBUG && console.log("PRODUCT_MODULE_ENABLED")
287273
const { product_categories, count } = await fetch(
288274
`${API_BASE_URL}/api/categories?offset=${offset}&limit=${limit}`,
289275
{
@@ -303,7 +289,6 @@ export async function getCategoriesList(
303289
}
304290
}
305291

306-
DEBUG && console.log("PRODUCT_MODULE_DISABLED")
307292
const { product_categories, count } = await medusaRequest(
308293
"GET",
309294
"/product-categories",
@@ -336,7 +321,6 @@ export async function getCategoryByHandle(categoryHandle: string[]): Promise<{
336321
product_categories: ProductCategoryWithChildren[]
337322
}> {
338323
if (PRODUCT_MODULE_ENABLED) {
339-
DEBUG && console.log("PRODUCT_MODULE_ENABLED")
340324
const data = await fetch(
341325
`${API_BASE_URL}/api/categories/${categoryHandle}`,
342326
{
@@ -353,8 +337,6 @@ export async function getCategoryByHandle(categoryHandle: string[]): Promise<{
353337
return data
354338
}
355339

356-
DEBUG && console.log("PRODUCT_MODULE_DISABLED")
357-
358340
const handles = categoryHandle.map((handle: string, index: number) =>
359341
categoryHandle.slice(0, index + 1).join("/")
360342
)
@@ -403,7 +385,6 @@ export async function getProductsByCategoryHandle({
403385
nextPage: number
404386
}> {
405387
if (PRODUCT_MODULE_ENABLED) {
406-
DEBUG && console.log("PRODUCT_MODULE_ENABLED")
407388
const { response, nextPage } = await fetch(
408389
`${API_BASE_URL}/api/categories/${handle}?currency_code=${currencyCode}&page=${pageParam.toString()}`,
409390
{
@@ -423,7 +404,6 @@ export async function getProductsByCategoryHandle({
423404
}
424405
}
425406

426-
DEBUG && console.log("PRODUCT_MODULE_DISABLED")
427407
const { id } = await getCategoryByHandle([handle]).then(
428408
(res) => res.product_categories[0]
429409
)

src/lib/util/get-prices-by-price-set-id.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export async function getPricesByPriceSetId({
3535

3636
variant.price = price
3737
variant.calculated_price = price.amount
38-
console.log({ variant })
3938
}
4039
}
4140
return products

0 commit comments

Comments
 (0)