Fondation

This commit is contained in:
alma 2026-01-16 23:20:58 +01:00
parent 0d2b60587f
commit bb5ff67250

View File

@ -264,11 +264,13 @@ export async function POST(request: Request) {
}
export async function DELETE(request: Request) {
// Authenticate user (declare outside try to access in catch)
const session = await getServerSession(authOptions);
if (!session?.user?.id) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}
try {
const session = await getServerSession(authOptions);
if (!session?.user?.id) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}
const { searchParams } = new URL(request.url);
const accountId = searchParams.get('accountId');
if (!accountId) {