diff --git a/src/components/community/modal/QnaRegModal.jsx b/src/components/community/modal/QnaRegModal.jsx index 86d62428..d04f00fa 100644 --- a/src/components/community/modal/QnaRegModal.jsx +++ b/src/components/community/modal/QnaRegModal.jsx @@ -13,6 +13,7 @@ import { QcastContext } from '@/app/QcastProvider' import { useAxios } from '@/hooks/useAxios' import { globalLocaleStore } from '@/store/localeAtom' import { e } from 'mathjs' +import { set } from 'react-hook-form' export default function QnaRegModal({ setOpen, setReload, searchValue, selectPageBlock }) { @@ -24,6 +25,7 @@ export default function QnaRegModal({ setOpen, setReload, searchValue, selectPag const [qnaData, setQnaData] = useState([]) const [closeMdFlg, setCloseMdFlg] = useState(true) const [closeSmFlg, setCloseSmFlg] = useState(true) + const [hideSmFlg, setHideSmFlg] = useState(false) const qnaTypeLgCodeRef = useRef(null) const qnaTypeMdCodeRef = useRef(null) const qnaTypeSmCodeRef = useRef(null) @@ -71,7 +73,7 @@ let fileCheck = false; regUserTelNoRef.current.value = '' qnaTypeLgCodeRef.current.setValue(); qnaTypeMdCodeRef.current.setValue(); - qnaTypeSmCodeRef.current.setValue(); + qnaTypeSmCodeRef.current?.setValue(); titleRef.current.value = '' contentsRef.current.value = '' @@ -112,7 +114,7 @@ let fileCheck = false; setQnaData({ ...qnaData, qnaClsLrgCd:e.clCode}) setCloseMdFlg(false) qnaTypeMdCodeRef.current.setValue(); - qnaTypeSmCodeRef.current.setValue(); + qnaTypeSmCodeRef.current?.setValue(); } } @@ -131,10 +133,20 @@ let fileCheck = false; } }) - setQnaTypeSmCodeList(codeList) + + setQnaData({ ...qnaData, qnaClsMidCd: e.clCode }) setCloseSmFlg(false) - qnaTypeSmCodeRef.current.setValue(); + setQnaTypeSmCodeList(codeList) + qnaTypeSmCodeRef.current?.setValue(); + + if(codeList.length > 0) { + setHideSmFlg(false) + }else{ + setHideSmFlg(true) + } + + } @@ -393,6 +405,7 @@ let fileCheck = false; />