Fondation
This commit is contained in:
parent
0d2b60587f
commit
bb5ff67250
@ -264,11 +264,13 @@ export async function POST(request: Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function DELETE(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 {
|
try {
|
||||||
const session = await getServerSession(authOptions);
|
|
||||||
if (!session?.user?.id) {
|
|
||||||
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
|
|
||||||
}
|
|
||||||
const { searchParams } = new URL(request.url);
|
const { searchParams } = new URL(request.url);
|
||||||
const accountId = searchParams.get('accountId');
|
const accountId = searchParams.get('accountId');
|
||||||
if (!accountId) {
|
if (!accountId) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user