The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Update app.ts
Kiran K4399d25866e4
diff --git a/apps/web/lib/middleware/app.ts b/apps/web/lib/middleware/app.tsindex 8aa2b6e93d..7bfac37d12 100644--- a/apps/web/lib/middleware/app.ts+++ b/apps/web/lib/middleware/app.ts@@ -1,4 +1,3 @@-import { prismaEdge } from "@dub/prisma/edge";import { NextRequest, NextResponse } from "next/server";import {ONBOARDING_WINDOW_SECONDS,@@ -115,44 +114,44 @@ export async function AppMiddleware(req: NextRequest) {);}- if (path.startsWith("/onboarding/welcome")) {- // Redirect users with pending workspace invites away from onboarding- // to accept their invitation instead of creating a new workspace- const pendingInvite = await prismaEdge.projectInvite.findFirst({- where: {- email: user.email,- },- select: {- project: {- select: {- slug: true,- },- },- },- });-- if (pendingInvite) {- return NextResponse.redirect(- new URL(`/${pendingInvite.project.slug}?invite=1`, req.url),- );- }-- // If user already has a workspace, redirect them away from onboarding- // to their workspaces page instead of allowing them to create a new one- const existingWorkspace = await prismaEdge.project.findFirst({- where: {- users: {- some: {- userId: user.id,- },- },- },- });-- if (existingWorkspace) {- return NextResponse.redirect(new URL("/workspaces", req.url));- }- }+ // if (path.startsWith("/onboarding/welcome")) {+ // // Redirect users with pending workspace invites away from onboarding+ // // to accept their invitation instead of creating a new workspace+ // const pendingInvite = await prismaEdge.projectInvite.findFirst({+ // where: {+ // email: user.email,+ // },+ // select: {+ // project: {+ // select: {+ // slug: true,+ // },+ // },+ // },+ // });++ // if (pendingInvite) {+ // return NextResponse.redirect(+ // new URL(`/${pendingInvite.project.slug}?invite=1`, req.url),+ // );+ // }++ // // If user already has a workspace, redirect them away from onboarding+ // // to their workspaces page instead of allowing them to create a new one+ // const existingWorkspace = await prismaEdge.project.findFirst({+ // where: {+ // users: {+ // some: {+ // userId: user.id,+ // },+ // },+ // },+ // });++ // if (existingWorkspace) {+ // return NextResponse.redirect(new URL("/workspaces", req.url));+ // }+ // }}// otherwise, rewrite the path to /app