From 5b25d7e750d88fa3d71b6a61e9990017653719fa Mon Sep 17 00:00:00 2001 From: david emioma Date: Sun, 31 Mar 2024 17:21:14 +0100 Subject: [PATCH] Deployment issues #2 --- .../[storeId]/products/[productId]/route.ts | 20 +++++++++---------- .../stores/[storeId]/products/new/route.ts | 20 +++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/app/api/stores/[storeId]/products/[productId]/route.ts b/app/api/stores/[storeId]/products/[productId]/route.ts index 321936d..2b0c7bb 100644 --- a/app/api/stores/[storeId]/products/[productId]/route.ts +++ b/app/api/stores/[storeId]/products/[productId]/route.ts @@ -7,10 +7,10 @@ import { UserRole, storeStatus } from "@prisma/client"; import { currentRole, currentUser } from "@/lib/auth"; import { ProductSchema } from "@/lib/validators/product"; -const ratelimit = new Ratelimit({ - redis, - limiter: Ratelimit.slidingWindow(5, "60 s"), -}); +// const ratelimit = new Ratelimit({ +// redis, +// limiter: Ratelimit.slidingWindow(5, "60 s"), +// }); export async function PATCH( request: Request, @@ -24,13 +24,13 @@ export async function PATCH( return new NextResponse("Unauthorized", { status: 401 }); } - const { success } = await ratelimit.limit(user.id ?? ""); + // const { success } = await ratelimit.limit(user.id ?? ""); - if (!success && process.env.VERCEL_ENV === "production") { - return new NextResponse("Too Many Requests! try again in 1 min", { - status: 429, - }); - } + // if (!success && process.env.VERCEL_ENV === "production") { + // return new NextResponse("Too Many Requests! try again in 1 min", { + // status: 429, + // }); + // } const { storeId, productId } = params; diff --git a/app/api/stores/[storeId]/products/new/route.ts b/app/api/stores/[storeId]/products/new/route.ts index ce5e511..f4c3a15 100644 --- a/app/api/stores/[storeId]/products/new/route.ts +++ b/app/api/stores/[storeId]/products/new/route.ts @@ -7,10 +7,10 @@ import { UserRole, storeStatus } from "@prisma/client"; import { currentRole, currentUser } from "@/lib/auth"; import { ProductSchema } from "@/lib/validators/product"; -const ratelimit = new Ratelimit({ - redis, - limiter: Ratelimit.slidingWindow(5, "60 s"), -}); +// const ratelimit = new Ratelimit({ +// redis, +// limiter: Ratelimit.slidingWindow(5, "60 s"), +// }); export async function POST( request: Request, @@ -30,13 +30,13 @@ export async function POST( return new NextResponse("Unauthorized", { status: 401 }); } - const { success } = await ratelimit.limit(user.id ?? ""); + // const { success } = await ratelimit.limit(user.id ?? ""); - if (!success && process.env.VERCEL_ENV === "production") { - return new NextResponse("Too Many Requests! try again in 1 min", { - status: 429, - }); - } + // if (!success && process.env.VERCEL_ENV === "production") { + // return new NextResponse("Too Many Requests! try again in 1 min", { + // status: 429, + // }); + // } //Check if user is a seller const { role } = await currentRole();