initial commit

This commit is contained in:
Zacharias-Brohn
2026-01-14 06:12:55 +01:00
commit d702390660
46 changed files with 21386 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
import { NextRequest, NextResponse } from 'next/server';
import { jwtVerify } from 'jose';
const JWT_SECRET = new TextEncoder().encode(
process.env.JWT_SECRET || 'your-secret-key-at-least-32-chars-long'
);
export async function GET(request: NextRequest) {
const token = request.cookies.get('token')?.value;
if (!token) {
return NextResponse.json({ user: null }, { status: 200 });
}
try {
const { payload } = await jwtVerify(token, JWT_SECRET);
return NextResponse.json({ user: payload }, { status: 200 });
} catch (error) {
return NextResponse.json({ user: null }, { status: 200 });
}
}