261102_04_ENH: 설문현황 KON·KIWI 바로가기를 환경별 KART 프로젝트 URL로 변경

This commit is contained in:
2026-11-02 16:07:03 +09:00
parent 475204b12b
commit 5a82fe6396
8 changed files with 26 additions and 96 deletions

View File

@@ -24,28 +24,6 @@ export const GET = async (req: NextRequest, context: RouteContext) => {
return NextResponse.json(result, { status: 200 });
}
if(action === "survey-redirect-url" && slug.length === 3){
const [, isKiwi, pkey] = slug;
if (!["0", "1"].includes(isKiwi)) {
return NextResponse.json({ message: "프로젝트 정보를 확인해 주세요." }, { status: 400 });
}
// Contact backend를 거쳐 KON/KIWI 현황 공유 링크를 발급한다.
const result = await contactApi.post<unknown>(
`/kart/project/${isKiwi}/${encodeURIComponent(pkey)}/share`,
{},
{ expectText: true },
);
const shortUrl = typeof result === "string" && /^https?:\/\//.test(result)
? result
: null;
if (!shortUrl) {
return NextResponse.json({ message: "KART 공유 링크 응답을 확인해 주세요." }, { status: 502 });
}
return NextResponse.json(shortUrl, { status: 200 });
}
return NextResponse.json({ message: "Not found" }, { status: 404 });
} catch (error: unknown) {
return errorToResponse(error);