link-stack/apps/leafcutter/app/api/searches/list/route.ts
2023-07-11 13:48:05 +00:00

12 lines
436 B
TypeScript

import { NextResponse } from "next/server";
import { getServerSession } from "next-auth";
import { authOptions } from "app/_lib/auth";
import { getUserMetadata } from "app/_lib/opensearch";
export const GET = async () => {
const session = await getServerSession(authOptions);
const { user: { email } }: any = session;
const { savedSearches } = await getUserMetadata(email);
return NextResponse.json(savedSearches);
};