mirror of
				https://github.com/DerTyp7/f1r3wave-website.git
				synced 2025-10-31 05:57:07 +01:00 
			
		
		
		
	Added debug logs to file upload
This commit is contained in:
		| @@ -52,6 +52,7 @@ export async function GET(request: NextRequest) { | ||||
| } | ||||
|  | ||||
| export async function POST(request: NextRequest) { | ||||
|   console.log('upload file', request); | ||||
|   if (!(await isAuthenticated(request))) { | ||||
|     return NextResponse.json({ error: 'Unauthorized' }, { status: 401 }); | ||||
|   } | ||||
|   | ||||
| @@ -18,11 +18,13 @@ export async function getAuthStatus() { | ||||
| } | ||||
|  | ||||
| export async function isAuthenticated(request: NextRequest): Promise<boolean> { | ||||
|   console.log('isAuthenticated'); | ||||
|   const token = await getToken({ req: request, secret: process.env.AUTH_SECRET }); | ||||
|  | ||||
|   console.log('token', token); | ||||
|   if (!token || (token.exp && Date.now() / 1000 > token.exp)) { | ||||
|     console.log('false'); | ||||
|     return false; | ||||
|   } | ||||
|  | ||||
|   console.log('true'); | ||||
|   return true; | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user