2023-06-28 09:09:45 +00:00
|
|
|
import { NextResponse } from "next/server";
|
|
|
|
|
import { getServerSession } from "next-auth";
|
2023-07-11 13:48:05 +00:00
|
|
|
import { authOptions } from "app/_lib/auth";
|
|
|
|
|
import { getUserMetadata } from "app/_lib/opensearch";
|
2023-06-28 09:09:45 +00:00
|
|
|
|
|
|
|
|
export const GET = async () => {
|
|
|
|
|
const session = await getServerSession(authOptions);
|
|
|
|
|
const { user: { email } }: any = session;
|
|
|
|
|
const { savedSearches } = await getUserMetadata(email);
|
|
|
|
|
|
|
|
|
|
return NextResponse.json(savedSearches);
|
|
|
|
|
};
|