link-stack/apps/leafcutter/app/api/visualizations/delete/route.ts

16 lines
521 B
TypeScript
Raw Normal View History

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
export const POST = async (req: NextRequest, res: NextResponse) => {
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 });
};