This commit is contained in:
Zacharias-Brohn
2026-01-14 20:02:17 +01:00
parent 8ddd4e47ec
commit f5197d92f7
14 changed files with 10823 additions and 13030 deletions
+18 -1
View File
@@ -1,5 +1,6 @@
import { NextRequest, NextResponse } from 'next/server';
import { jwtVerify } from 'jose';
import { prisma } from '@/lib/prisma';
const JWT_SECRET = new TextEncoder().encode(
process.env.JWT_SECRET || 'your-secret-key-at-least-32-chars-long'
@@ -14,7 +15,23 @@ export async function GET(request: NextRequest) {
try {
const { payload } = await jwtVerify(token, JWT_SECRET);
return NextResponse.json({ user: payload }, { status: 200 });
const userId = payload.userId as string;
// Fetch fresh user data from database to get current settings
const user = await prisma.user.findUnique({
where: { id: userId },
select: {
id: true,
username: true,
accentColor: true,
},
});
if (!user) {
return NextResponse.json({ user: null }, { status: 200 });
}
return NextResponse.json({ user }, { status: 200 });
} catch (error) {
return NextResponse.json({ user: null }, { status: 200 });
}