diff --git a/src/components/categorySelect.js b/src/components/categorySelect.js index bac6c8b..5ec6e0f 100644 --- a/src/components/categorySelect.js +++ b/src/components/categorySelect.js @@ -31,7 +31,7 @@ export default function CategorySelect(props) { // console.log(selectedCategory); useEffect(() => { props.categoryseq(selectedCategory); - }, []); + }, [selectedCategory]); const SelectBox = (props) => { // console.log(props.options.category); return ( diff --git a/src/components/datepicker.js b/src/components/datepicker.js index f96bacf..b57a1b5 100644 --- a/src/components/datepicker.js +++ b/src/components/datepicker.js @@ -14,8 +14,7 @@ export default function StudyDatePicker(props) { const [startDate, setStartDate] = useState(addDays(new Date(), 7)); //yyyy-mm-dd 포맷 날짜 생성 - function changeDateFormat() { - const d = startDate; + function changeDateFormat(d) { return ( d.getFullYear() + "-" + @@ -27,8 +26,8 @@ export default function StudyDatePicker(props) { ); } useEffect(() => { - props.endDate(changeDateFormat()); - }, []); + props.endDate(changeDateFormat(startDate)); + }, [startDate]); const months = [ "January", diff --git a/src/components/paginator.js b/src/components/paginator.js index de69d2c..d7be513 100644 --- a/src/components/paginator.js +++ b/src/components/paginator.js @@ -5,12 +5,13 @@ import "../statics/css/paginator.css"; export default function Paginator(props) { const [page, setPage] = useState(1); + const handlePageChange = (page) => { setPage(page); }; useEffect(() => { props.currentpage(page); - }, []); + }, [page]); return ( { setSearchInput(event.target.value); @@ -31,19 +32,11 @@ export default function StudyRecruit() { const onClickSearch = useCallback(() => { if (isLogin) { axios - .get( - "/studies?page=" + - currenPage + - "&type=" + - category + - "&key=" + - searchInput, - { - headers: { - Authorization: `Bearer ${TOKEN}`, - }, - } - ) + .get("/studies?page=1&type=" + category + "&key=" + searchInput, { + headers: { + Authorization: `Bearer ${TOKEN}`, + }, + }) .then((res) => { const data = res.data.data; setPostData((prevState) => ({ @@ -62,11 +55,19 @@ export default function StudyRecruit() { useEffect(() => { if (isLogin) { axios - .get("/studies?page=1&type=0&key=", { - headers: { - Authorization: `Bearer ${TOKEN}`, - }, - }) + .get( + "/studies?page=" + + currentPage + + "&type=" + + category + + "&key=" + + searchInput, + { + headers: { + Authorization: `Bearer ${TOKEN}`, + }, + } + ) .then((res) => { // console.log(res); const data = res.data.data; @@ -76,7 +77,7 @@ export default function StudyRecruit() { })); }); } - }, []); + }, [currentPage]); return (
diff --git a/src/pages/studyRecruitCreate.js b/src/pages/studyRecruitCreate.js index 3b6848c..6af7d72 100644 --- a/src/pages/studyRecruitCreate.js +++ b/src/pages/studyRecruitCreate.js @@ -214,8 +214,7 @@ export default function StudyRecruitCreate() { const [studyShortDesc, setStudyShotrDesc] = useState(""); const [studyDesc, setStudyDesc] = useState(""); const [studyRecruitEnd, setStudyRecruitEnd] = useState(""); - const [categorySeq, setCategorySeq] = useState(""); - console.log(userSeq, studyTitle, studyShortDesc, studyDesc, studyRecruitEnd); + const [categorySeq, setCategorySeq] = useState(0); // [TODO]: 스터디 상세정보 글자수 실시간으로 보여주기 (1000자 제한) const onChangeStudyDesc = useCallback((event) => { @@ -300,6 +299,18 @@ export default function StudyRecruitCreate() { } }, [isSunday, sunday]); + console.log( + userSeq, + typeof Number(categorySeq), + Number(categorySeq), + studyTitle, + studyShortDesc, + studyDesc, + studyRecruitEnd, + days, + studyDesc.length + ); + const onSubmitStudy = useCallback(() => { const TOKEN = localStorage.getItem("accessToken"); axios @@ -307,7 +318,7 @@ export default function StudyRecruitCreate() { "/studies", { hostSea: userSeq, - categorySeq: categorySeq, + categorySeq: Number(categorySeq), studyTitle: studyTitle, studyShortDesc: studyShortDesc, studyDesc: studyDesc, @@ -323,7 +334,16 @@ export default function StudyRecruitCreate() { .then((res) => { navigate("/studyrecruit"); }); - }, []); + }, [ + userSeq, + categorySeq, + studyTitle, + studyShortDesc, + studyDesc, + studyRecruitEnd, + days, + ]); + // console.log(days); // console.log(categorySeq); return ( diff --git a/src/statics/css/studyRecruitCreate.css b/src/statics/css/studyRecruitCreate.css index 09daeb6..5aed423 100644 --- a/src/statics/css/studyRecruitCreate.css +++ b/src/statics/css/studyRecruitCreate.css @@ -120,6 +120,7 @@ margin-top: 5px; padding-left: 8px; font-size: 12px; + color: var(--textColor); } .recruit-create .recruit-create-contents .recruit-create-content ::placeholder { font-size: 12px; @@ -147,6 +148,7 @@ border: 1px solid var(--borderColor); background-color: var(--bgColor); padding: 12px; + color: var(--textColor); } .recruit-create center button { cursor: pointer; diff --git a/src/statics/css/studyRecruitCreate.css.map b/src/statics/css/studyRecruitCreate.css.map index 579b0e6..5485f3f 100644 --- a/src/statics/css/studyRecruitCreate.css.map +++ b/src/statics/css/studyRecruitCreate.css.map @@ -1 +1 @@ -{"version":3,"sourceRoot":"","sources":["../scss/main.scss","../scss/studyRecruitCreate.scss"],"names":[],"mappings":"AAAQ;AAUR;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EAEA;EACA;EACA;EAEA;;;AAIF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EAEA;EACA;EACA;EAEA;;;AAQF;EACE;;;AC3DF;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;;AACA;EACE;;AAKF;EACE;;AAEA;EACE;;AAOA;EACE;;AAEF;EACE;EACA;EACA;EACA;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;EACA;EACA;EACA;;AAEF;EACE;;AAEA;EACE;;AAIJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA,kBDpEE;ECqEF;EACA;EACA;;AAGJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;;AAEF;EACE;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;;AAMN;EACE;EACA;EACA;EACA;EACA,kBD3HM;EC4HN;EACA;EACA;EACA;EACA;EACA;EACA","file":"studyRecruitCreate.css"} \ No newline at end of file +{"version":3,"sourceRoot":"","sources":["../scss/main.scss","../scss/studyRecruitCreate.scss"],"names":[],"mappings":"AAAQ;AAUR;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EAEA;EACA;EACA;EAEA;;;AAIF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EAEA;EACA;EACA;EAEA;;;AAQF;EACE;;;AC3DF;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;;AACA;EACE;;AAKF;EACE;;AAEA;EACE;;AAOA;EACE;;AAEF;EACE;EACA;EACA;EACA;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;EACA;EACA;EACA;;AAEF;EACE;;AAEA;EACE;;AAIJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA,kBDpEE;ECqEF;EACA;EACA;;AAGJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;;AAEF;EACE;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAMN;EACE;EACA;EACA;EACA;EACA,kBD7HM;EC8HN;EACA;EACA;EACA;EACA;EACA;EACA","file":"studyRecruitCreate.css"} \ No newline at end of file diff --git a/src/statics/scss/studyRecruitCreate.scss b/src/statics/scss/studyRecruitCreate.scss index f4dc229..e7edeac 100644 --- a/src/statics/scss/studyRecruitCreate.scss +++ b/src/statics/scss/studyRecruitCreate.scss @@ -89,6 +89,7 @@ margin-top: 5px; padding-left: 8px; font-size: 12px; + color: var(--textColor); } ::placeholder { font-size: 12px; @@ -117,6 +118,7 @@ border: 1px solid var(--borderColor); background-color: var(--bgColor); padding: 12px; + color: var(--textColor); } } }