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 Teya2c6c57fc6b3
diff --git a/apps/web/app/api/workspaces/route.ts b/apps/web/app/api/workspaces/route.ts
index f9f89a6000..3e6120a3f4 100644
--- a/apps/web/app/api/workspaces/route.ts
+++ b/apps/web/app/api/workspaces/route.ts
@@ -116,29 +116,19 @@ export const POST = withSession(async ({ req, session }) => {
},
});
- waitUntil(
- (async () => {
- // SOON: create a referral link for the workspace
- // await dub.links.create({
- // domain: "refer.dub.co",
- // key: slug,
- // url: "https://dub.co",
- // externalId: `ws_${workspaceResponse.id}`,
- // tagIds: ["cm000srqx0004o6ldehod07zc"],
- // trackConversion: true,
- // });
- if (session.user["defaultWorkspace"] === null) {
- await prisma.user.update({
- where: {
- id: session.user.id,
- },
- data: {
- defaultWorkspace: workspaceResponse.slug,
- },
- });
- }
- })(),
- );
+ // if the user has no default workspace, set the new workspace as the default
+ if (session.user["defaultWorkspace"] === null) {
+ waitUntil(
+ prisma.user.update({
+ where: {
+ id: session.user.id,
+ },
+ data: {
+ defaultWorkspace: workspaceResponse.slug,
+ },
+ }),
+ );
+ }
return NextResponse.json(
WorkspaceSchema.parse({