setup done

This commit is contained in:
Om Lanke
2025-06-25 15:25:44 +05:30
parent ceb4b6b811
commit 2b777df5e2
55 changed files with 503 additions and 90 deletions

View File

@@ -1 +1,18 @@
export { auth as middleware } from "@workspace/auth";
import { auth } from "@workspace/auth";
import { NextResponse } from 'next/server';
export default auth((req: any) => {
// If the user is unauthenticated or an admin, allow the request.
if (!req.auth || req.auth.user?.role === "ADMIN") {
return NextResponse.next();
}
// Otherwise, redirect to the student app.
const studentUrl = process.env.STUDENT_URL ?? "http://localhost:3000"
return NextResponse.redirect(new URL(studentUrl, req.url));
}) as any;
export const config = {
matcher: ["/((?!api|_next/static|_next/image|favicon.ico).*)"],
}