단위테스트 오류 수정.

This commit is contained in:
2025-08-12 10:12:29 +09:00
parent db441ab353
commit 32ce555321
2 changed files with 17 additions and 3 deletions
+10 -3
View File
@@ -104,6 +104,7 @@ function ImageForm({ form, imgSn, ...props }: ImageFormProps) {
value={field.value ?? ""}
className="!text-[1.3rem]"
placeholder="이미지명을 입력해주세요"
maxLength={100}
/>
</FormControl>
</FormItem>
@@ -126,11 +127,17 @@ function ImageForm({ form, imgSn, ...props }: ImageFormProps) {
min={0}
max={9999}
value={field.value ?? ""}
onChange={(e) =>
field.onChange(parseInt(e.target.value))
}
onChange={(e) => {
const value = parseInt(e.target.value);
if (value > 9999) {
field.onChange(9999);
} else {
field.onChange(value);
}
}}
className="w-[12rem] !text-[1.3rem]"
placeholder="정렬순서 입력"
maxLength={4}
/>
</FormControl>
</FormItem>
@@ -4,6 +4,7 @@ import { useRouter } from "next/navigation";
import { useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import { useQuery, useQueryClient } from "@tanstack/react-query";
import { useEffect } from "react";
import { SiteApi, siteFormSchema, type SiteFormData } from "@/entities/site";
import { useAlertStore, useMutationWrapper } from "@/shared/lib";
import { ENDPOINT } from "@/shared/config";
@@ -27,6 +28,12 @@ function ModifyPage({ siteId }: { siteId: string }) {
enabled: !!siteId,
});
useEffect(() => {
if (siteDetail === undefined && siteId) {
alert("사이트 정보를 찾을 수 없습니다.", () => router.push("/site"));
}
}, [siteDetail, siteId]);
const { mutateAsync: updateSite } = useMutationWrapper({
mutationFn: (data: SiteFormData) => SiteApi.updateSite(siteId, data),
onSuccess: () => {