diff --git a/gongjakso/public/index.html b/gongjakso/public/index.html index a570f14..37adef3 100644 --- a/gongjakso/public/index.html +++ b/gongjakso/public/index.html @@ -23,13 +23,13 @@ gtag('config', 'G-757LG6FY1Q'); -공작소 +공모전 팀빌딩 서비스 | 공작소 gongjakso - + @@ -37,7 +37,7 @@ - + diff --git a/gongjakso/src/components/common/CountGuest/CountGuest.jsx b/gongjakso/src/components/common/CountGuest/CountGuest.jsx index 3e81bda..7312f3e 100644 --- a/gongjakso/src/components/common/CountGuest/CountGuest.jsx +++ b/gongjakso/src/components/common/CountGuest/CountGuest.jsx @@ -6,6 +6,7 @@ const CountGuest = ({ isProject, maxGuests, onApply }) => { const [roles, setRoles] = useState({ 기획: 0, 디자인: 0, + 개발자: 0, ...(isProject && { FE: 0, BE: 0 }), 기타: 0, }); diff --git a/gongjakso/src/pages/ProfilePage/ProfilePage.jsx b/gongjakso/src/pages/ProfilePage/ProfilePage.jsx index 8d55893..ea1ced9 100644 --- a/gongjakso/src/pages/ProfilePage/ProfilePage.jsx +++ b/gongjakso/src/pages/ProfilePage/ProfilePage.jsx @@ -21,6 +21,8 @@ const MAX_PORTFOLIOS = 3; const ProfilePage = () => { const [data, setProfileData] = useState(); + const authenticated = localStorage.getItem('accessToken'); + const [isLoggedIn, setIsLoggedIn] = useState(!!authenticated); const [postContent1, setPostContent1] = useState(); const [postContent2, setPostContent2] = useState(); const [postContent3, setPostContent3] = useState(); @@ -37,6 +39,9 @@ const ProfilePage = () => { const [portfolioList, setPortfolioList] = useState([]); useEffect(() => { + if (!isLoggedIn) { + navigate(`/`); + } getMyInfo().then(response => { setProfileData(response?.data); }); @@ -49,7 +54,7 @@ const ProfilePage = () => { getMyParticipated(1, 2).then(response => { setPostContent3(response?.data?.content); }); - }, []); + }, [isLoggedIn]); useEffect(() => { if (selectedPortfolioId && selectedPortfolioType) { fetchPortfolioDetailsByType( diff --git a/gongjakso/src/service/portfolio_service.js b/gongjakso/src/service/portfolio_service.js index 503fe1e..f297c73 100644 --- a/gongjakso/src/service/portfolio_service.js +++ b/gongjakso/src/service/portfolio_service.js @@ -9,7 +9,9 @@ export const getAllPortfolio = async () => { const response = await axiosInstanceV2.get(reqURL); return response; } catch (error) { - console.log(error); + error.response.data.code = 3004 + ? localStorage.removeItem('accessToken') + : console.log(error.response.data.message); return error.response.data.code; } }; @@ -49,7 +51,9 @@ export const getPortfolio = async id => { const response = await axiosInstanceV2.get(reqURL); return response; } catch (error) { - console.log(error); + error.response.data.code = 3004 + ? localStorage.removeItem('accessToken') + : console.log(error.response.data.message); return error.response?.data.code; } }; @@ -62,7 +66,9 @@ export const getExistPortfolio = async (id, type) => { const response = await axiosInstanceV2.get(reqURL); return response; } catch (error) { - console.log('Error getting portfolio details:', error); + error.response.data.code = 3004 + ? localStorage.removeItem('accessToken') + : console.log(error.response.data.message); return error.response.data.code; } }; diff --git a/gongjakso/src/service/post_service.js b/gongjakso/src/service/post_service.js index 6f24bbe..ff81c16 100644 --- a/gongjakso/src/service/post_service.js +++ b/gongjakso/src/service/post_service.js @@ -103,7 +103,9 @@ export const getMyPortfolio = async () => { const response = await axiosInstanceV2.get(reqURL); return response.data; } catch (error) { - console.log(error); + error.response.data.code = 3004 + ? localStorage.removeItem('accessToken') + : console.log(error.response.data.message); } }; diff --git a/gongjakso/src/service/profile_service.js b/gongjakso/src/service/profile_service.js index 1173ac5..fc48ee3 100644 --- a/gongjakso/src/service/profile_service.js +++ b/gongjakso/src/service/profile_service.js @@ -14,6 +14,7 @@ export const putMyInfo = async (name, major, job, status, phone) => { }); return response.data; } catch (error) { + console.log(error); throw new Error('나의 정보를 가져올 수 없습니다.'); } }; @@ -25,7 +26,9 @@ export const getMyInfo = async () => { const response = await axiosInstance.get(reqURL); return response.data; } catch (error) { - console.log('내가 지원한 게시글을 가져올 수 없습니다.'); + error.response.data.code = 3004 + ? localStorage.removeItem('accessToken') + : console.log(error.response.data.message); } }; @@ -37,7 +40,9 @@ export const getMyRecruiting = async (page, size) => { const response = await axiosInstanceV2.get(reqURL); return response.data; } catch (error) { - console.log('내가 모집 중인 게시글을 가져올 수 없습니다.', error); + error.response.data.code = 3004 + ? localStorage.removeItem('accessToken') + : console.log(error.response.data.message); } }; @@ -49,7 +54,9 @@ export const getMyApplied = async page => { const response = await axiosInstanceV2.get(reqURL); return response.data; } catch (error) { - console.log('내가 지원한 게시글을 가져올 수 없습니다.'); + error.response.data.code = 3004 + ? localStorage.removeItem('accessToken') + : console.log(error.response.data.message); } }; @@ -62,7 +69,9 @@ export const getMyParticipated = async (page, size) => { const response = await axiosInstanceV2.get(reqURL); return response.data; } catch (error) { - console.log(error); + error.response.data.code = 3004 + ? localStorage.removeItem('accessToken') + : console.log(error.response.data.message); } }; @@ -72,7 +81,9 @@ export const getMyContestScrap = async () => { const response = await axiosInstance.get(reqURL); return response.data; } catch (error) { - console.log('내가 스크랩한 공모전 정보를 가져올 수 없습니다.'); + error.response.data.code = 3004 + ? localStorage.removeItem('accessToken') + : console.log(error.response.data.message); } }; @@ -82,7 +93,9 @@ export const getMyProjectScrap = async () => { const response = await axiosInstance.get(reqURL); return response.data; } catch (error) { - console.log('내가 스크랩한 프로젝트 정보를 가져올 수 없습니다.'); + error.response.data.code = 3004 + ? localStorage.removeItem('accessToken') + : console.log(error.response.data.message); } }; export const getMyTeamScrap = async (page, size) => { @@ -91,6 +104,8 @@ export const getMyTeamScrap = async (page, size) => { const response = await axiosInstanceV2.get(reqURL); return response.data; } catch (error) { - console.log('내가 스크랩한 프로젝트 정보를 가져올 수 없습니다.'); + error.response.data.code = 3004 + ? localStorage.removeItem('accessToken') + : console.log(error.response.data.message); } };