diff --git a/src/app/api/message/[[...slug]]/route.ts b/src/app/api/message/[[...slug]]/route.ts index 0f8d187..d24ac93 100644 --- a/src/app/api/message/[[...slug]]/route.ts +++ b/src/app/api/message/[[...slug]]/route.ts @@ -2,7 +2,7 @@ import {NextRequest, NextResponse} from "next/server"; import {RouteContext} from "@/types/common"; import {createContactApi} from "@/lib/http-server"; import {errorToResponse} from "@kri/common/http"; -import type {MessageBulkSendResponse} from "@/types/message"; +import type {MessageBulkSendResponse, SendSingleResponse} from "@/types/message"; const isChannel = (value: string): value is "sms" | "email" => value === "sms" || value === "email"; @@ -22,8 +22,8 @@ export const POST = async (req: NextRequest, context: RouteContext) => { } if (action === "single") { - await contactApi.post(`/message/${channel}/single/${prjctIdx}`, body); - return new NextResponse(null, {status: 204}); + const result = await contactApi.post(`/message/${channel}/single/${prjctIdx}`, body); + return NextResponse.json(result, {status: 200}); } if (action === "bulk") { diff --git a/src/components/dialog/SingleMessageSendDialog.tsx b/src/components/dialog/SingleMessageSendDialog.tsx index 1274c53..436d398 100644 --- a/src/components/dialog/SingleMessageSendDialog.tsx +++ b/src/components/dialog/SingleMessageSendDialog.tsx @@ -144,8 +144,9 @@ const SingleMessageSendDialog = ({ }) // cmid는 발송 CMID이며 verificationId와는 다른 식별자이므로 혼용하지 않는다. - const cmid = res.cmid - if (isPhoneVerificationTemplate) { + // 서버 응답 바디가 비어 있는 경우(res가 null)를 대비해 안전하게 접근한다. + const cmid = res?.cmid + if (isPhoneVerificationTemplate && res?.data) { // 휴대전화번호 인증 응답. verificationId/expireDt는 이후 인증 단계에서 사용할 값이나, // 이 시스템에서는 인증번호 확인 절차를 사용하지 않으므로 현재는 별도로 활용하지 않는다. const { verificationId, expireDt } = res.data as PhoneVerificationSendData