[as] feat: 설치인가 수정 페이지 수정

This commit is contained in:
2026-06-30 12:27:13 +09:00
parent 0533d229e6
commit 3b4d9df0e8
3 changed files with 17 additions and 9 deletions
@@ -49,8 +49,8 @@ export function mapDetailToFormData(data: InstlSncnMngDetResponse): CnfmRegistFo
envoSeComCd: detDto.envoSeComCd,
prgrsSttsComCd: detDto.prgrsSttsComCd,
atchFileGroupId: detDto.atchFileGroupId ?? "",
rtlztnFcltSeComCd: detDto.rtlztnFcltSeComCd,
rtlztnUsgSeComCd: detDto.rtlztnUsgSeComCd,
rtlztnFcltSeComCd: detDto.rtlztnFcltSeComCd ?? "",
rtlztnUsgSeComCd: detDto.rtlztnUsgSeComCd ?? "",
envoSeCdNm: detDto.envoSeCdNm,
sncnSeCdNm: detDto.sncnSeCdNm,
taskSeCdNm: detDto.taskSeCdNm,
@@ -15,7 +15,7 @@ function InstlEditPage({ id }: InstlEditPageProps) {
return <div className="mt-6 text-xl">수정 대상을 찾을 수 없습니다.</div>;
}
return <InstlFormPage mode="edit" initialData={data} />;
return <InstlFormPage id={id} mode="edit" initialData={data} />;
}
export { InstlEditPage };
@@ -5,9 +5,14 @@ import { FormProvider, useForm } from "react-hook-form";
import { useRouter } from "next/navigation";
import { zodResolver } from "@hookform/resolvers/zod";
import { useQueryClient } from "@tanstack/react-query";
import { useAlertStore, useUserStore } from "@/shared/lib";
import { type InstlSncnMngDetResponse, instlSncnService } from "@/entities/instl-sncn";
import {
instlSncnKeys,
type InstlSncnMngDetResponse,
instlSncnService,
} from "@/entities/instl-sncn";
import { Button } from "@common/components";
import {
@@ -26,12 +31,14 @@ import { ContactInfoFormSection } from "./sections/contact-info-form-section";
import { PrivacyConsentSection } from "./sections/privacy-consent-section";
interface InstlFormPageProps {
id?: string;
mode: "create" | "edit";
initialData?: InstlSncnMngDetResponse;
taskSeComCd?: string[];
}
function InstlFormPage({ mode, initialData, taskSeComCd }: InstlFormPageProps) {
function InstlFormPage({ id, mode, initialData, taskSeComCd }: InstlFormPageProps) {
const queryClient = useQueryClient();
const router = useRouter();
const userInfo = useUserStore((state) => state.userInfo);
const alert = useAlertStore((state) => state.setMessage);
@@ -70,11 +77,12 @@ function InstlFormPage({ mode, initialData, taskSeComCd }: InstlFormPageProps) {
const instlSncnDocNo = await instlSncnService.saveApply(payload);
alert(isEditMode ? "수정되었습니다." : "저장되었습니다.");
alert("저장되었습니다.");
router.push(`/instl-sncn/${instlSncnDocNo}`);
if (isEditMode && id) queryClient.invalidateQueries({ queryKey: instlSncnKeys.detail(id) });
} catch (error) {
console.error(isEditMode ? "수정 실패:" : "저장 실패:", error);
alert(isEditMode ? "수정 중 오류가 발생했습니다." : "저장 중 오류가 발생했습니다.");
console.error("저장 실패:", error);
alert("저장 중 오류가 발생했습니다.");
} finally {
setIsSubmitting(false);
}
@@ -108,7 +116,7 @@ function InstlFormPage({ mode, initialData, taskSeComCd }: InstlFormPageProps) {
목록
</Button>
<Button type="submit" disabled={isSubmitting}>
{isEditMode ? "수정" : "저장"}
저장
</Button>
</div>
</div>