Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Update route.ts

Steven Tey3b76298c2a82
diff --git a/apps/web/app/api/campaigns/callback/stripe/route.ts b/apps/web/app/api/campaigns/callback/stripe/route.ts
index bdcd908859..129a38e029 100644
--- a/apps/web/app/api/campaigns/callback/stripe/route.ts
+++ b/apps/web/app/api/campaigns/callback/stripe/route.ts
@@ -1,4 +1,4 @@
-import prisma from "@/lib/prisma";
+import { prismaEdge } from "@/lib/prisma/edge";
import z from "@/lib/zod";
import { getSearchParams } from "@dub/utils";
import { redirect } from "next/navigation";
@@ -9,19 +9,20 @@ const schema = z.object({
stripe_user_id: z.string(),
});
+export const runtime = "edge";
+
export const GET = async (req: NextRequest) => {
- const { state, stripe_user_id: stripeConnectId } = schema.parse(
+ const { state: workspaceId, stripe_user_id: stripeConnectId } = schema.parse(
getSearchParams(req.url),
);
// TODO:
// Create a unique state before redirecting to Stripe (and store it in the Redis)
// And validate it here
- const workspaceId = state.replace("ws_", "");
- const workspace = await prisma.project.update({
+ const workspace = await prismaEdge.project.update({
where: {
- id: workspaceId,
+ id: workspaceId.replace("ws_", ""),
},
data: {
stripeConnectId,