1- import { NextURL } from ' next/dist/server/web/next-url' ;
2- import { type NextRequest , NextResponse } from ' next/server' ;
1+ import { NextURL } from " next/dist/server/web/next-url" ;
2+ import { type NextRequest , NextResponse } from " next/server" ;
33
44const PUBLIC_ROUTES = [ "/login" , "/register" ] ;
55
@@ -18,29 +18,30 @@ async function isValidToken(TOKEN: string): Promise<boolean> {
1818}
1919
2020export default async function middleware ( request : NextRequest ) {
21- const REDIRECT_TO_LOGIN = NextResponse . redirect ( new NextURL ( "/login" , request . url ) ) ;
21+ const REDIRECT_TO_LOGIN = NextResponse . redirect (
22+ new NextURL ( "/login" , request . url )
23+ ) ;
2224 const TOKEN = request . cookies . get ( "TOKEN" ) ;
2325 if ( TOKEN == undefined ) {
2426 return REDIRECT_TO_LOGIN ;
2527 }
26-
27- if ( ! await isValidToken ( TOKEN . value ) ) {
28- REDIRECT_TO_LOGIN . cookies . delete ( "TOKEN" ) ;
29- return REDIRECT_TO_LOGIN ;
30- }
28+
29+ // if (!await isValidToken(TOKEN.value)) {
30+ // REDIRECT_TO_LOGIN.cookies.delete("TOKEN");
31+ // return REDIRECT_TO_LOGIN;
32+ // }
3133
3234 return NextResponse . next ( ) ;
33-
3435}
3536
3637export const config = {
37- matcher : "/((?!api|_next/static|_next/image|favicon.ico|sitemap.xml|robots.txt|login|register).*)" ,
38+ matcher :
39+ "/((?!api|_next/static|_next/image|favicon.ico|sitemap.xml|robots.txt|login|register).*)" ,
3840 // matcher: [
3941 // "/matching",
4042 // "/",
4143 // "/profile",
4244 // "/question",
4345 // "/question/.*",
4446 // ],
45- }
46-
47+ } ;
0 commit comments