-
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathmiddleware.ts
More file actions
22 lines (20 loc) · 787 Bytes
/
middleware.ts
File metadata and controls
22 lines (20 loc) · 787 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { NextRequest } from "next/server";
import authConfig from "./auth.config";
import NextAuth from "next-auth";
// Use only one of the two middleware options below
// 1. Use middleware directly
// export const { auth: middleware } = NextAuth(authConfig)
// 2. Wrapped middleware option
// @ts-expect-error: auth is not updated
const { auth } = NextAuth(authConfig);
export default auth(async function middleware(req: NextRequest) {
console.log(req);
});
// Your custom middleware logic goes here
// const { nextUrl } = req;
// // console.log(auth);
// //if is auth and try to reconnecte redirect
// const url = ["/signin", "/register"];
// if (url.includes(nextUrl.pathname)) {
// return Response.redirect(new URL(`${process.env.NEXT_PUBLIC_SERVER_URL}`));
// }