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 next.js bug

Steven Tey6415c96a8cba
diff --git a/apps/web/app/api/auth/saml/authorize/route.ts b/apps/web/app/api/auth/saml/authorize/route.ts
index 524190b05e..4bf75eac39 100644
--- a/apps/web/app/api/auth/saml/authorize/route.ts
+++ b/apps/web/app/api/auth/saml/authorize/route.ts
@@ -1,6 +1,6 @@
import jackson from "@/lib/jackson";
import { getSearchParams } from "@/lib/auth";
-import { redirect } from "next/navigation";
+import { NextResponse } from "next/server";
const handler = async (req: Request) => {
const { oauthController } = await jackson();
@@ -13,7 +13,9 @@ const handler = async (req: Request) => {
);
if (redirect_url) {
- redirect(redirect_url);
+ return NextResponse.redirect(redirect_url, {
+ status: 302,
+ });
} else {
return new Response(authorize_form, {
headers: {
diff --git a/apps/web/app/api/auth/saml/callback/route.ts b/apps/web/app/api/auth/saml/callback/route.ts
index 5b95795d91..e8490b105a 100644
--- a/apps/web/app/api/auth/saml/callback/route.ts
+++ b/apps/web/app/api/auth/saml/callback/route.ts
@@ -1,5 +1,5 @@
import jackson from "@/lib/jackson";
-import { redirect } from "next/navigation";
+import { NextResponse } from "next/server";
export async function POST(req: Request) {
const { oauthController } = await jackson();
@@ -18,5 +18,7 @@ export async function POST(req: Request) {
throw new Error("No redirect URL found.");
}
- redirect(redirect_url);
+ return NextResponse.redirect(redirect_url, {
+ status: 302,
+ });
}
diff --git a/apps/web/app/api/auth/saml/userinfo/index.ts b/apps/web/app/api/auth/saml/userinfo/index.ts
index 5c20c08f74..28df3070f8 100644
--- a/apps/web/app/api/auth/saml/userinfo/index.ts
+++ b/apps/web/app/api/auth/saml/userinfo/index.ts
@@ -1,25 +1,6 @@
import jackson from "@/lib/jackson";
import { NextResponse } from "next/server";
-// export default async function handler(
-// req: NextApiRequest,
-// res: NextApiResponse,
-// ) {
-// const { oauthController } = await jackson();
-
-// const authHeader = req.headers["authorization"];
-
-// if (!authHeader) {
-// throw new Error("Unauthorized");
-// }
-
-// const token = authHeader.split(" ")[1];
-
-// const user = await oauthController.userInfo(token);
-
-// return res.json(user);
-// }
-
export async function GET(req: Request) {
const { oauthController } = await jackson();