[apps/cs] fix: 하위코드 등록 폼 에러 해결 (CS_UT08010104)

This commit is contained in:
2025-07-10 17:08:19 +09:00
parent 29bc717b2c
commit e5b8bf2685
2 changed files with 9 additions and 2 deletions
@@ -1,7 +1,7 @@
import { memo } from "react";
import { useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import { useQuery } from "@tanstack/react-query";
import { useQuery, useQueryClient } from "@tanstack/react-query";
import { useConfirm } from "@frontend-opensource/use-react-hooks";
import {
Button,
@@ -50,8 +50,8 @@ const LwpoCodeManagementDialog = memo(
...props
}: ManagementLwpoCodeDialogProps) => {
const isRegistration = !lwpoCd;
const { confirm } = useConfirm();
const queryClient = useQueryClient();
const alert = useAlertStore((state) => state.setMessage);
const { data: detailData } = useQuery({
@@ -70,6 +70,9 @@ const LwpoCodeManagementDialog = memo(
mutationFn: (data: LwpoCodeFormData) => LwpoCodeApi.createLwpoCode(data),
onSuccess: () => {
alert("등록되었습니다.", () => onOpenChange?.(false));
queryClient.invalidateQueries({
queryKey: [ENDPOINT.CMS_SERVICE.LWPO_CODE, upCd],
});
},
});
@@ -251,6 +254,9 @@ const LwpoCodeManagementDialog = memo(
{...field}
type="number"
value={field.value ?? 0}
onChange={(e) => {
field.onChange(parseInt(e.target.value));
}}
className="!text-[1.3rem]"
placeholder="정렬순서를 입력해주세요"
/>
@@ -116,6 +116,7 @@ function LwpoCodeSection({ upCd }: LwpoCodeSectionProps) {
코드갱신
</Button>
<LwpoCodeManagementDialog
upCd={upCd}
open={dialogOpen}
onOpenChange={setDialogOpen}
>