diff --git a/src/app/api/message-template/[[...slug]]/route.ts b/src/app/api/message-template/[[...slug]]/route.ts index 621dff8..bd542d0 100644 --- a/src/app/api/message-template/[[...slug]]/route.ts +++ b/src/app/api/message-template/[[...slug]]/route.ts @@ -11,6 +11,19 @@ export const GET = async (req: NextRequest, context: RouteContext) => { const [action] = slug; const notihubApi = await createNotihubApi(); + if(slug.length === 2 && slug[1] === "attachment"){ + const fileName = searchParams.get("fileName"); + if (!fileName) { + return NextResponse.json({ message: "fileName은 필수입니다." }, { status: 400 }); + } + + const result = await notihubApi.get( + `/template/${slug[0]}/attachment?fileName=${encodeURIComponent(fileName)}`, + { expectBinary: true }, + ); + return new NextResponse(result, { status: 200, headers: { "Content-Type": "application/octet-stream" } }); + } + if(slug.length === 1){ const result = await notihubApi.get