diff --git a/src/app/api/seminar/open/info/route.tsx b/src/app/api/seminar/open/info/route.tsx new file mode 100644 index 0000000..b537c3d --- /dev/null +++ b/src/app/api/seminar/open/info/route.tsx @@ -0,0 +1,48 @@ +import { Client } from '@notionhq/client'; +import { NotionToMarkdown } from "notion-to-md"; +import { NextRequest } from 'next/server'; + +const notion = new Client({ + auth: process.env.NOTION_SECRET_KEY, +}); + +const n2m = new NotionToMarkdown({ notionClient: notion }); + +async function getPageMarkdown(pageId: string): Promise { + const mdblocks = await n2m.pageToMarkdown(pageId); + const mdString = n2m.toMarkdownString(mdblocks); + return mdString; +} + + +// Next.js의 API 라우트 핸들러 +export async function GET(req: NextRequest) { + const url = new URL(req.url); + const pageId = url.searchParams.get('pageId'); + + if (!pageId) { + return new Response(JSON.stringify({ message: 'pageId is required' }), { + status: 400, + headers: { + 'Content-Type': 'application/json', + }, + }); + } + + try { + const pageContent = await getPageMarkdown(pageId); + return new Response(JSON.stringify({ data: pageContent, message: 'Success' }), { + status: 200, + headers: { + 'Content-Type': 'application/json', + }, + }); + } catch (error) { + return new Response(JSON.stringify({ message: `Failed: ${error?.toString()}` }), { + status: 500, + headers: { + 'Content-Type': 'application/json', + }, + }); + } +} \ No newline at end of file diff --git a/src/app/seminar/open/[id]/page.tsx b/src/app/seminar/open/[id]/page.tsx index b8ea17b..34bbd64 100644 --- a/src/app/seminar/open/[id]/page.tsx +++ b/src/app/seminar/open/[id]/page.tsx @@ -45,6 +45,10 @@ const OpenSeminarDetailPage = async () => { }) ); + const markDownResponse = await fetch(`http://localhost:3001/api/seminar/open/info?pageId=${openSeminar.id}`); + const markdown = await markDownResponse.json(); + // console.log('real ::: ', markdown); + return
@@ -56,7 +60,7 @@ const OpenSeminarDetailPage = async () => { {/* seminars */} {/* information */} - +
diff --git a/src/components/seminar/openSeminarDetail/banner/OpenSeminarDetailBanner.tsx b/src/components/seminar/openSeminarDetail/banner/OpenSeminarDetailBanner.tsx index 9089d0d..8b169f7 100644 --- a/src/components/seminar/openSeminarDetail/banner/OpenSeminarDetailBanner.tsx +++ b/src/components/seminar/openSeminarDetail/banner/OpenSeminarDetailBanner.tsx @@ -24,7 +24,7 @@ const OpenSeminarDetailBanner = ({ openSeminar }: { openSeminar: OpenSeminar }) return (
{/* 왼쪽 컨텐츠 */} -
+
{/* 오른쪽 컨텐츠 */} -
+
-
+
translate_img { +const OpenSeminarDetailInformation = ({ information }: { information:any }) => { return (
@@ -24,7 +24,7 @@ const OpenSeminarDetailInformation = ({ openSeminar }: { openSeminar: OpenSemina Information

-

+
+ {information?.data?.parent}