초기화 함수만 추가
This commit is contained in:
@@ -74,7 +74,7 @@ export type FormData = z.infer<typeof sdmInfoFormSchema>;
|
||||
|
||||
function SdmInfoInsertContent() {
|
||||
const searchParams = useSearchParams();
|
||||
const {map, insertSdmInfoData, Sdm } = useDmStore((state) => state);
|
||||
const {map, insertSdmInfoData, Sdm ,setSubsInfo} = useDmStore((state) => state);
|
||||
const { successLogin } = Sdm;
|
||||
const [ismoneyDisabled, setIsmoneyDisabled] = useState(false);
|
||||
const formSchema = sdmInfoFormSchema;
|
||||
@@ -127,6 +127,8 @@ function SdmInfoInsertContent() {
|
||||
if (local) {
|
||||
setIsLogin(true);
|
||||
}
|
||||
setSubsInfo([]); // subsInfo 초기화 후보지 처음 화면 들어올때 초기화(스토어내 객체만)
|
||||
|
||||
}, []);
|
||||
|
||||
const form = useForm<FormData>({
|
||||
@@ -135,7 +137,10 @@ function SdmInfoInsertContent() {
|
||||
mode: "onChange",
|
||||
});
|
||||
|
||||
|
||||
|
||||
useEffect(()=>{
|
||||
//map.subsInfo 스토어 객체 값이 변경되면 해당 값이 폼에 자동으로 들어가도록 수정 대신 값이 있어야함
|
||||
if(map.subsInfo.length>0){
|
||||
form.setValue('candidateTitle', map.subsInfo)
|
||||
}
|
||||
@@ -154,6 +159,7 @@ function SdmInfoInsertContent() {
|
||||
setFacilityName(userData.dmdCoNm);
|
||||
form.setValue('sdmNm', userData.dmdCoNm);
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error parsing user data:', error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user