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.

fix integrations redirect

Steven Tey7895c507a6cc
diff --git a/apps/web/lib/middleware/app.ts b/apps/web/lib/middleware/app.ts
index fd7809d21e..7b8bf267a3 100644
--- a/apps/web/lib/middleware/app.ts
+++ b/apps/web/lib/middleware/app.ts
@@ -60,11 +60,18 @@ export default async function AppMiddleware(req: NextRequest) {
const defaultWorkspace = await getDefaultWorkspace(user);
if (defaultWorkspace) {
+ let redirectPath = path;
+ if (["/", "/login", "/register"].includes(path)) {
+ redirectPath = "";
+ } else if (
+ path === "/integrations" ||
+ path.startsWith("/integrations/")
+ ) {
+ redirectPath = `/settings/${path}`;
+ }
return NextResponse.redirect(
new URL(
- `/${defaultWorkspace}${
- ["/", "/login", "/register"].includes(path) ? "" : path
- }${searchParamsString}`,
+ `/${defaultWorkspace}${redirectPath}${searchParamsString}`,
req.url,
),
);