반응형

아래 함수를 useEffect(,[])에서 못 부름

위치가 문제인가?

setListData
const setListData = () => {
        setCurrent(true);
        noticeSeq.current = null;
        const query = new Query();
        let queryId = '';
        if (currentTab === 1) {
            queryId = '/cmmNotice/selectFarmFaqList';
        }
        if (currentTab === 0) {
            queryId = '/cmmNotice/selectNoticeList';
        }

        if (currentTab === 1) {
            let checkCategory = [];
            let checkboxList, allCheckbox;
            allCheckbox = document.querySelector('#checkallFaqType');
            checkboxList = document.querySelectorAll('._checkboxFaqType');
            if (allCheckbox.checked) {
                for (let i = 0; i < checkboxList.length; i++) {
                    checkCategory.push((checkboxList.item(i)).value)
                };
            } else {
                for (let i = 0; i < checkboxList.length; i++) {
                    if ((checkboxList.item(i)).checked === true) {
                        checkCategory.push((checkboxList.item(i)).value)
                    }
                };
            }
            if (checkCategory.length > 0) {
                query.addParams('cond_check_faq_type', checkCategory);
            }
            srchParamKeyword.current = txtSrchFaq.current.value;
            srchParamCond.current = cmbOptCondFaq.current.value;
        }
        if (currentTab === 0) {
            query.addParams('cond_st_dt', getFromDateStr(new Date()));
            query.addParams('cond_ed_dt', getFromDateStr(new Date()));
            srchParamKeyword.current = txtSrchNotice.current.value;
            srchParamCond.current = cmbOptCondNotice.current.value;
        }

        if (srchParamKeyword.current !== '') {
            if (srchParamCond.current === initialData.dsSearchTypeList[1].VALUE) {
                query.addParams('cond_title', srchParamKeyword.current);
            } else if (srchParamCond.current === initialData.dsSearchTypeList[2].VALUE) {
                query.addParams('cond_content', srchParamKeyword.current);
            } else if (srchParamCond.current === initialData.dsSearchTypeList[0].VALUE) {
                query.addParams('cond_title_content', srchParamKeyword.current);
            }
        }

        query.addParams('cond_use_yn', 'Y');

        const dataManager = one.createDataManger(
            {
                service: 'farmos',
                queryId: queryId
            }
        );

        dataManager.executeQuery(
            query,
            (res) => {
                if (currentTab === 1) {
                }
                if (currentTab === 0) {
                }
                boardList.current.setBoardList(res.result);
            },
            (error) => {
                const message = one.resMsg(error);
                one.alertMsg('', message);
            }
        )
    }
반응형

+ Recent posts