fix: revert wut

This commit is contained in:
Akshay Rajput 2025-01-11 04:31:04 +05:30
parent cd86a7ad42
commit ff70624283
Signed by: TheHamkerCat
GPG Key ID: 4B32A124C668ECFF

View File

@ -3,20 +3,20 @@ import type { Session } from "better-auth/types";
import { type NextRequest, NextResponse } from "next/server";
export default async function authMiddleware(request: NextRequest) {
// const { data: session } = await betterFetch<Session>(
// "/api/auth/get-session",
// {
// baseURL: request.nextUrl.origin,
// headers: {
// //get the cookie from the request
// cookie: request.headers.get("cookie") || "",
// },
// },
// );
const { data: session } = await betterFetch<Session>(
"/api/auth/get-session",
{
baseURL: request.nextUrl.origin,
headers: {
//get the cookie from the request
cookie: request.headers.get("cookie") || "",
},
},
);
// if (!session) {
// return NextResponse.redirect(new URL("/login", request.url));
// }
if (!session) {
return NextResponse.redirect(new URL("/login", request.url));
}
return NextResponse.next();
}