2023-06-28 09:09:45 +00:00
|
|
|
import { NextRequest, NextResponse } from "next/server";
|
|
|
|
|
import { getServerSession } from "next-auth";
|
2023-07-11 13:48:05 +00:00
|
|
|
import { authOptions } from "app/_lib/auth";
|
|
|
|
|
import { deleteUserVisualization } from "app/_lib/opensearch";
|
2023-06-28 09:09:45 +00:00
|
|
|
|
2024-11-25 09:31:25 +01:00
|
|
|
export const POST = async (req: NextRequest) => {
|
|
|
|
|
const session = await getServerSession(authOptions);
|
|
|
|
|
const {
|
|
|
|
|
user: { email },
|
|
|
|
|
}: any = session;
|
|
|
|
|
const { id } = await req.json();
|
|
|
|
|
await deleteUserVisualization(email as string, id);
|
|
|
|
|
|
|
|
|
|
return NextResponse.json({ id });
|
2023-06-28 09:09:45 +00:00
|
|
|
};
|