diff --git a/.env.production b/.env.production index 49127c8..04a85ae 100644 --- a/.env.production +++ b/.env.production @@ -1 +1,2 @@ -REACT_APP_API_URL=http://www.goming.site:8080 +# REACT_APP_API_URL=http://www.goming.site:8080 +REACT_APP_API_URL=http://49.50.174.69:8080 diff --git a/src/components/ETCUpdatePopup.tsx b/src/components/ETCUpdatePopup.tsx index ae36137..3f2f495 100644 --- a/src/components/ETCUpdatePopup.tsx +++ b/src/components/ETCUpdatePopup.tsx @@ -27,7 +27,6 @@ const ETCUpdatePopup = ({updateActive, setUpdateActive}:PROPS ) => { alert("모든 항목을 입력해주세요.") } else { if (updateActive.qcategory === c && updateActive.qquestion === q && updateActive.qwriter === w) { - console.log('변경사항이 없습니다.'); close() } else { const param = { diff --git a/src/components/main/MyCalendar.tsx b/src/components/main/MyCalendar.tsx index 46c9b72..d93f41f 100644 --- a/src/components/main/MyCalendar.tsx +++ b/src/components/main/MyCalendar.tsx @@ -93,8 +93,6 @@ const MyCalendar = () => { value, view, }: any) => { - console.log("******************************"); - console.log("month move", activeStartDate); initAnsweredList(); //답변목록 초기화 initAnsweredDateCount(); //날짜별 답변개수 초기화 @@ -142,7 +140,6 @@ const MyCalendar = () => { const hasData = answeredDateCount?.findIndex( (item) => item.date.toString() === convertedDate ); // 동일한 일자인지 체크 - console.log('hasData', hasData); if (type === "day" && hasData === -1) { initAnsweredList() } else { @@ -219,7 +216,6 @@ const MyCalendar = () => { //1회만 실행 useEffect(() => { - console.log("useEffect2"); const newMonth: any = dateFormat.getYearAndMonth(today); getQnAList(newMonth, "month"); setSelectDate(selectedDate); //cardstore 에 selectedDate 기본 설정 diff --git a/src/components/main/NowSelectionStep.tsx b/src/components/main/NowSelectionStep.tsx index 7e3108f..aa3ef6e 100644 --- a/src/components/main/NowSelectionStep.tsx +++ b/src/components/main/NowSelectionStep.tsx @@ -1,4 +1,5 @@ import 'assets/components/card-select-main/nowSelectionStep.css' +import useCardState from 'store/modules/CardState'; const stepList = [{index: 1}, {index: 2}, {index: 3}]; /** @@ -7,7 +8,7 @@ const stepList = [{index: 1}, {index: 2}, {index: 3}]; * @일자 2023.04.10. * @내용 잔여 질문뽑기 횟수 안내 */ -const NowSelectionStep = ({nowStep}: OBJ_NUMBER) => { +const NowSelectionStep = () => { return ( <>
@@ -17,7 +18,7 @@ const NowSelectionStep = ({nowStep}: OBJ_NUMBER) => {
{ stepList.map(item => ( - + )) }
@@ -26,13 +27,15 @@ const NowSelectionStep = ({nowStep}: OBJ_NUMBER) => { ) } -export const Step = ({i, nowStep}:STEP) => { +export const Step = ({i}:STEP) => { + const {todayCardSelectStep} = useCardState() //카드 상태 관리 store + return ( <>
-

{i}회

@@ -40,9 +43,6 @@ export const Step = ({i, nowStep}:STEP) => { } type STEP = { i: number //index - nowStep: number //현재회차 -} -type OBJ_NUMBER = { - nowStep: number //현재회차 } + export default NowSelectionStep \ No newline at end of file diff --git a/src/components/mypage/Withdrawal2.tsx b/src/components/mypage/Withdrawal2.tsx index 63f1f20..314046a 100644 --- a/src/components/mypage/Withdrawal2.tsx +++ b/src/components/mypage/Withdrawal2.tsx @@ -80,12 +80,10 @@ const Withdrawal2 = ({step, setStep}: WITHDRAWAL) => { if (otherCheck.checked === true) { if( withdrawalText.length < 1 ) {//내용없을시 로직 종료 setTextCountOverErrorText('기타 선택 시, 답변을 입력해주셔야 합니다.') - console.log(textCountOverErrorText) setWithdrawalTextError(true) return; } else if (withdrawalText.length > 300) { setTextCountOverErrorText('최대 길이는 300자 입니다.') - console.log(textCountOverErrorText) setWithdrawalTextError(true) return; } else { diff --git a/src/composables/ETC/index.ts b/src/composables/ETC/index.ts index 29e8495..6deb3e6 100644 --- a/src/composables/ETC/index.ts +++ b/src/composables/ETC/index.ts @@ -15,7 +15,6 @@ export const exportToExcel = async (search: string, list:Array) => { const workBookName = '추가한 질문 목록'; const workbook = new Excel.Workbook(); try { - console.log('exportExcel') const fileName = search.length > 0 ? search : workBookName; const worksheet = workbook.addWorksheet(workSheetName); diff --git a/src/pages/auth/Login.tsx b/src/pages/auth/Login.tsx index 63cd4b1..c547a0d 100644 --- a/src/pages/auth/Login.tsx +++ b/src/pages/auth/Login.tsx @@ -72,9 +72,6 @@ const Login: React.FC = () => { setPasswordVerify(true); } - console.log(passwordVerify); - console.log(emailFormChk); - if (emailCheckResult && passwordCheckResult) { //유효성 검사 통과 시 로그인 로직 checkRememberEmail(); //이메일 저장 로컬스토리지에 설정 @@ -91,8 +88,6 @@ const Login: React.FC = () => { alert(result.data); // 알림컴포넌트창 출력 return; } else { - console.log('로그인완료'); - // const userInfoData: TYPE_USER_INFO = result?.data && result?.data; const userInfoData: any = result?.data && result?.data; if (userInfoData) { diff --git a/src/pages/etc/ShowNewQuestions.tsx b/src/pages/etc/ShowNewQuestions.tsx index f5a6676..d79f947 100644 --- a/src/pages/etc/ShowNewQuestions.tsx +++ b/src/pages/etc/ShowNewQuestions.tsx @@ -71,7 +71,6 @@ const ShowNewQuestions = () => { //목록 수정 const updateItem = (item:ETC_QS_TYPE) => { setUpdateActive(item) - console.log(item); } //엑셀 출력 @@ -92,7 +91,6 @@ const ShowNewQuestions = () => { //infinity scroll useEffect(() => { if (inView && hasNextPage && !isSearched) { - console.log("다음페이지를 호출."); const param = {page:page+1, size} setPage(page+1) fetch(param); diff --git a/src/pages/main/Answer.tsx b/src/pages/main/Answer.tsx index 5648e48..c51d3b6 100644 --- a/src/pages/main/Answer.tsx +++ b/src/pages/main/Answer.tsx @@ -37,8 +37,6 @@ const Answer = () => { setConfirmButtonText("질문 선택하러 가기") } setHeaderText('답변 작성하기') - console.log('useEffect', oneCard[0]); - if (oneCard.length === 0) { navigate('/main', {replace:true}) } @@ -81,8 +79,6 @@ const Answer = () => { // 로그인 되었을 경우 // 2.답변 저장 - api 호출 - callbackfunction const insertAnswer = async () => { - console.log(oneCard[0]); - const param:ANSWER_CONTENT = { qNo: oneCard[0].qno, //질문 index aWriter: userInfo.eml, //작성자 @@ -103,7 +99,8 @@ const Answer = () => { //다음 질문 카드 뽑으러 가기 const goToNextQuestion = () => { - updateCardSelectStep(todayCardSelectStep + 1) + let newTodayCardSelectStep = todayCardSelectStep + updateCardSelectStep(++newTodayCardSelectStep) //단계 추가(답변없음) navigate('/main', {replace:true}) //새로운 카드 출력 or 캘린더 화면으로 이동처리 } @@ -120,7 +117,9 @@ const Answer = () => { } await passAnswer(param) //답변 건너뛰기 - updateCardSelectStep(todayCardSelectStep + 1) //단계 추가(답변없음) + + let newTodayCardSelectStep = todayCardSelectStep + updateCardSelectStep(++newTodayCardSelectStep) //단계 추가(답변없음) resetAllCards() //카드 초기화 navigate('/main', {replace:true}) //메인화면으로 이동(카드선택 화면) } diff --git a/src/pages/main/MainContent.tsx b/src/pages/main/MainContent.tsx index 3eca9c2..e9e89e8 100644 --- a/src/pages/main/MainContent.tsx +++ b/src/pages/main/MainContent.tsx @@ -31,8 +31,6 @@ const MainContent = () => { } = useCardState() //카드 상태 관리 store useEffect(() => { - console.log(fourCards, oneCard) - console.log(todayCardSelectStep); updateTodayCardSelectStatus(true) setHeaderText('') @@ -75,7 +73,7 @@ const MainContent = () => {
{/* 금일자, 사용자정보 */} - {/* 잔여 선택회수 */} + {/* 잔여 선택회수 */} {/* 카드 4개 출력 */}
diff --git a/src/pages/mypage/WithdrawalMain.tsx b/src/pages/mypage/WithdrawalMain.tsx index 4fc31ee..1542877 100644 --- a/src/pages/mypage/WithdrawalMain.tsx +++ b/src/pages/mypage/WithdrawalMain.tsx @@ -43,7 +43,6 @@ const WithdrawalMain = () => { //탈퇴 완료 시 이동할 페이지 : 로그인 const moveToMain = () => { - console.log('go to main') navigate('/login', {replace: true}) //navigate 초기화 } diff --git a/src/pages/onpager/OnePagerMain.tsx b/src/pages/onpager/OnePagerMain.tsx index ddb8702..6144bcd 100644 --- a/src/pages/onpager/OnePagerMain.tsx +++ b/src/pages/onpager/OnePagerMain.tsx @@ -168,7 +168,6 @@ const OnePagerMain = () => { formData.append("email", userInfo.eml); formData.append("sendEmail", email); formData.append("date", dateFormat.getYearAndMonth(selectedDate)); - console.log(formData.get("date")); if (formData.get("date") === "NaN-NaN") { setToastPopup(true); //토스트 팝업 출력 setToastText("선택된 파일이 없습니다."); @@ -194,21 +193,6 @@ const OnePagerMain = () => { }, } ); - // const param: any = { - // email: userInfo.eml, - // sendEmail: email, - // date: firstDate?.slice(0, 7), - // // image: imageURL, - // }; - - // //db connection - // console.log(param); - // const result: AxiosResponse = await fetch.post( - // "/api/email/sendByMonth", - // param - // ); - // console.log("result", result); - console.log(result); if (result.status === 200) { console.log("test"); } else { diff --git a/src/store/modules/Answers.ts b/src/store/modules/Answers.ts index b50f33a..c82798d 100644 --- a/src/store/modules/Answers.ts +++ b/src/store/modules/Answers.ts @@ -54,8 +54,6 @@ type ANSWER_TYPE = { * @returns {boolean} true: 이번달 이상, false: 이번달 이하 */ const checkIsMonthOver = (date: Date|string): boolean => { - console.log("checkIsMonthOver", date); - return new Date(date).getMonth() >= new Date().getMonth() } @@ -76,8 +74,6 @@ const useAnsweredList = create((set) => ({ * @return answeredList update */ getAnsweredList: async (param: any) => { - console.log(new Date(param.date).getMonth() + 1 + "월 답변 목록 조회"); - //param.date 가 이번 달 혹은 미래의 경우, api 를 조회하지 않고 빈 배열 반환 if (checkIsMonthOver(param.date)) { set({answeredList: { content: [], page: 0, size: 0, totalElements: 0 }}); @@ -90,8 +86,6 @@ const useAnsweredList = create((set) => ({ param.email }/${param.date.toString()}?size=${param?.size}&page=${param?.page}` ); - console.log("getAnsweredList", result?.data); - if (typeof result?.data === "object") { if (result.data?.content?.length > 0) { // answer 컬럼의 값이 존재하지 않을 경우 목록에서 해당 객체를 제거 @@ -104,7 +98,6 @@ const useAnsweredList = create((set) => ({ } } const newList = result?.data ? result?.data : []; //값이 없을 경우 빈 배열로 초기화 - console.log("getAnsweredList 조회 종료: ", newList); set({ answeredList: newList }); } else { set({ @@ -127,9 +120,8 @@ const useAnsweredList = create((set) => ({ */ getAnsweredDateCount: async (param: any) => { if (checkIsMonthOver(param.date)) { - console.log("getAnsweredDateCount -- 이번 혹은 미래를 조회하는 경우, api호출X"); - set({ answeredCount: 0 }); - set({ answeredDateCount: [] }); + set({ answeredCount: 0 }); + set({ answeredDateCount: [] }); } else { const result = await axios.get( `${process.env.REACT_APP_API_URL}/api/question/answeredCountDatesInMonth/${param.email}/${param.date}` @@ -160,7 +152,6 @@ const useAnsweredList = create((set) => ({ */ getAnsweredCount: async (param: any) => { if (checkIsMonthOver(param.date)) { - console.log("getAnsweredCount -- 이번 혹은 미래를 조회하는 경우, api호출X"); set({ answeredCount: 0 }); } else { let url: string = `${process.env.REACT_APP_API_URL}/api/question/answeredCount/${param.email}/`; @@ -226,11 +217,15 @@ const useAnsweredList = create((set) => ({ * @desc 이번 질문은 넘어갈래요 */ passAnswer: async (param: any): Promise => { - await axios.put( - `${process.env.REACT_APP_API_URL}/api/answers/passAnswer`, - param, - { withCredentials: false } - ); + try { + await axios.put( + `${process.env.REACT_APP_API_URL}/api/answers/passAnswer`, + param, + { withCredentials: false } + ); + } catch (error) { + console.log(error) + } }, })); diff --git a/src/store/modules/Auth.ts b/src/store/modules/Auth.ts index b589545..0de4077 100644 --- a/src/store/modules/Auth.ts +++ b/src/store/modules/Auth.ts @@ -34,13 +34,8 @@ const useAuthStore = create( newLoginState: boolean, userInfo: TYPE_USER_INFO ): void => { - console.log("updateLoginStatus start"); - console.log("newLoginState", newLoginState); - console.log("userInfo", userInfo); - set({ isLogin: newLoginState }); set({ userInfo: userInfo }); - console.log("updateLoginStatus end"); }, updateInfoChangeStatus: (newInfoChange: boolean): void => { set({ isInfoChange: newInfoChange }); diff --git a/src/store/modules/CardState.ts b/src/store/modules/CardState.ts index 171d3f8..4c9b29e 100644 --- a/src/store/modules/CardState.ts +++ b/src/store/modules/CardState.ts @@ -46,7 +46,7 @@ const useCardState = create((persist as pillListPersist) ******************************************************/ updateCardSelectStep: (nextStepNum:number): void => { const param = { - todayCardSelectStep: 1, + todayCardSelectStep: nextStepNum, todayCardSelectStatus: true } @@ -70,11 +70,19 @@ const useCardState = create((persist as pillListPersist) try { const param = {email: ''} param.email = email ? email : 'system' //로그인했을 경우 이메일, 아닐경우 빈값 전달 - // const response: AxiosResponse = await axios.get(`${process.env.REACT_APP_API_URL}/api/question/answered/day?writer=${param.email}`, {withCredentials: false}) - const today = getDateFormat01(new Date()) - const response: AxiosResponse = await axios.get(`${process.env.REACT_APP_API_URL}/api/question/answeredCount/${param.email}/${today}`, {withCredentials: false}) + // const today = getDateFormat01(new Date()) + const response: AxiosResponse = await axios.get(`${process.env.REACT_APP_API_URL}/api/question/unanswered/${param.email}`, {withCredentials: false}) - set({todayCardSelectStep: ++response.data}) // 단계 상태값 세팅 + const leftAnswerCount = response?.data + + // 단계 상태값 세팅 + if (4 - leftAnswerCount > 3 || 4 - leftAnswerCount < 1) { + set({todayCardSelectStatus: false}) + } else { + set({todayCardSelectStep: 4 - leftAnswerCount}) + set({todayCardSelectStatus: true}) + } + } catch (error) { console.log(error) } @@ -88,17 +96,8 @@ const useCardState = create((persist as pillListPersist) getCards: async (email?: string): Promise => { const param = {email: ''} param.email = email ? email : '' //로그인했을 경우 이메일, 아닐경우 빈값 전달 - // let url: string = `${process.env.REACT_APP_API_URL}` //axios url 초기화 - console.log('email', email); - - // if (email) { - // url += `/api/category/select?email=${param.email}` - // } else { - // url += `/api/category/select?email=""` - // } const url = `${process.env.REACT_APP_API_URL}/api/category/select?email=${param.email}` const response: AxiosResponse = await axios.get(url, {withCredentials: false}) - console.log(response) let cards:Array = [] //조회된 카드목록 let card:Array = [] //조회된 카드목록 @@ -117,7 +116,6 @@ const useCardState = create((persist as pillListPersist) card = response.data //조회된 카드(1개) } } else { - console.log('asdsad') card = [] cards = [] set({todayCardSelectStatus: false}) //더이상 선택 못함 diff --git a/src/store/modules/TestRegister.ts b/src/store/modules/TestRegister.ts index 4d4506a..c7157f0 100644 --- a/src/store/modules/TestRegister.ts +++ b/src/store/modules/TestRegister.ts @@ -42,7 +42,6 @@ const testRegisterStore = create( set((state) => ({ registerInfo: state.registerInfo.map((e) => { console.log(e); - console.log(usr_no); if (e.usr_no === usr_no) { console.log({ ...e, nickName, password }); return { ...e, nickName, password };