first commit

This commit is contained in:
a.alinaghipour
2026-04-05 15:53:20 +03:30
commit aa9ed69dd2
96 changed files with 7721 additions and 0 deletions

21
proxy.ts Normal file
View File

@@ -0,0 +1,21 @@
import { withAuth } from "next-auth/middleware";
import { NextResponse } from "next/server";
export default withAuth(
function middleware(req) {
const token = req.nextauth.token;
const isAdminRoute = req.nextUrl.pathname.startsWith("/admin");
if (isAdminRoute && token?.role !== "ADMIN") {
return NextResponse.redirect(new URL("/", req.url));
}
},
{
callbacks: {
authorized: ({ token }) => !!token,
},
}
);
export const config = {
matcher: ["/admin/:path*", "/team/:path*"],
};