From 70123e5977bc0c19ff3fce0187aa3a14d75c3327 Mon Sep 17 00:00:00 2001
From: gaeon <rkdjs1104@ajou.ac.kr>
Date: Sun, 10 Dec 2023 21:17:22 +0900
Subject: [PATCH] =?UTF-8?q?fix:=20channel=20=EC=83=9D=EC=84=B1=20bug=20fix?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/components/calendar/calendar.js      |  1 -
 src/components/channel/createChannel.js  |  2 --
 src/components/channel/myChannelModal.js |  6 ------
 src/components/search.js                 | 13 +++++--------
 src/pages/mypage.js                      |  6 ++++--
 src/pages/mypage.module.css              |  3 ++-
 6 files changed, 11 insertions(+), 20 deletions(-)

diff --git a/src/components/calendar/calendar.js b/src/components/calendar/calendar.js
index d8b1913..2025dfd 100644
--- a/src/components/calendar/calendar.js
+++ b/src/components/calendar/calendar.js
@@ -215,7 +215,6 @@ const MySchedulerApp = ({ setCount }) => {
       .then(response => response.json())
       .then(data => {
         const backendDataArray = data.schedules;
-        console.log("ghkrdls",data.schedules);
         const processedDataArray = [];
         for (const backendData of backendDataArray) {
           const startDate = new Date(backendData.date);
diff --git a/src/components/channel/createChannel.js b/src/components/channel/createChannel.js
index 6fee670..e0f6e1d 100644
--- a/src/components/channel/createChannel.js
+++ b/src/components/channel/createChannel.js
@@ -41,10 +41,8 @@ function CreateChannel({ isOpen, onClose }){
             console.log(JSON.stringify(formData));
 
             if (response.ok) {
-            // 성공적으로 모집글이 생성됨
                 alert('채널이 성공적으로 생성되었습니다.');
             } else {
-            // 오류 처리
                 alert('채널 생성에 실패하였습니다.');
             }
 
diff --git a/src/components/channel/myChannelModal.js b/src/components/channel/myChannelModal.js
index fd17db3..4db4cc1 100644
--- a/src/components/channel/myChannelModal.js
+++ b/src/components/channel/myChannelModal.js
@@ -14,16 +14,10 @@ const MyChannelModal=({isOpen, onClose})=>{
     openCreateModal();
     onClose();
   }
-  useEffect={
-    
-  }
-
 
   return(
     <div>
     <div className={`${modalStyles.channelModal} ${isOpen ? modalStyles.open : ''}`}>
-      
-        
           <div className={modalStyles.channelModal_overlay}>
           <div className={modalStyles.chModal}>
             <p>채널이 존재하지 않습니다.</p>
diff --git a/src/components/search.js b/src/components/search.js
index 5e21966..c19403c 100644
--- a/src/components/search.js
+++ b/src/components/search.js
@@ -4,8 +4,7 @@ import searchStyles from './search.module.css';
 import CreateRecruit from './recruit/createRecruit';
 import MyChannelModal from './channel/myChannelModal';
 import ExistingChannel from './channel/existingChannel';
-export const SearchContext = createContext();
-function Search({ currentPage, onUrlGenerated, onFirstQueryString, onSecondQueryString }){
+function Search({ currentPage, onUrlGenerated, onFirstQueryString, onSecondQueryString, fetchCount, setfetchCount }){
     const [isModalOpen, setIsModalOpen] = useState(false);
     const [ischannelOpen, setchannelModalOpen] = useState(false);
     const [searchTerm, setSearchTerm] = useState('');
@@ -13,12 +12,7 @@ function Search({ currentPage, onUrlGenerated, onFirstQueryString, onSecondQuery
     const [sortType, setSortType] = useState(''); 
     const [haveChannel, sethaveChannel]=useState(true);
     const [myChannelData, setmyChannelData]=useState('');
-    const [fetchCount, setfetchCount] = useState(0);
-    const searchValue = {
-        fetchCount,
-        setfetchCount,
-    };
-    
+
     const navigate = useNavigate();
 
     const openModal = () => {
@@ -54,9 +48,12 @@ function Search({ currentPage, onUrlGenerated, onFirstQueryString, onSecondQuery
           }
           else{
             sethaveChannel(false);
+            openchannelModal();
           }
         } catch (error) {
             console.error('Error fetching weekly schedules:', error);
+            sethaveChannel(false);
+            openchannelModal();
         }
     };
 
diff --git a/src/pages/mypage.js b/src/pages/mypage.js
index be85638..0e3b8bc 100644
--- a/src/pages/mypage.js
+++ b/src/pages/mypage.js
@@ -45,7 +45,7 @@ const Mypage=()=>{
   const closeMywriting=()=>{
     setIsmyWriting(false);
   }
-  const handleProfileUpdate = async ({ image, nickname, statusMessage }) => {
+  const handleProfileUpdate = async ({ imagePath, nickname, statusMessage }) => {
     try {
       if(nickname === ''){
         alert('닉네임을 입력해주세요.');
@@ -53,6 +53,8 @@ const Mypage=()=>{
     } else if(statusMessage===''){
         alert('상태 메시지를 입력해주세요.');
         return;
+    }else if(imagePath===''){
+      alert('이미지를 등록해주세요.');
     }
     const data={
       "nickname":nickname,
@@ -61,7 +63,7 @@ const Mypage=()=>{
  
       const formData = new FormData();
       formData.append('data', JSON.stringify(data));
-      formData.append('image', image)
+      formData.append('image', imagePath)
 
       const response = await fetch('api/mypage', {
         method: 'PUT',
diff --git a/src/pages/mypage.module.css b/src/pages/mypage.module.css
index 505dcaa..a28a17a 100644
--- a/src/pages/mypage.module.css
+++ b/src/pages/mypage.module.css
@@ -60,7 +60,8 @@
 .nickname{
   font-size:30px;
   color:black;
-  margin-top:-28%;
+  margin-top:-30%;
+  width:170px;
 }
 .message{
   margin-top:5%;
-- 
GitLab