diff --git a/src/component/detail/review/ReviewPage.jsx b/src/component/detail/review/ReviewPage.jsx
index 30d0c08..db494c2 100644
--- a/src/component/detail/review/ReviewPage.jsx
+++ b/src/component/detail/review/ReviewPage.jsx
@@ -1,15 +1,37 @@
import { useNavigate } from 'react-router-dom';
+import { useState } from 'react';
import ReviewBox from './ReviewBox';
import ReviewStatics from './ReviewStatics';
+import ErrorModal from '../../modal/ErrorModal';
import './reviewPage.css';
export default function ReviewPage({ clubId, clubName }) {
const navigate = useNavigate();
+ const isAdmin = localStorage.getItem('isAdmin');
+ const token = localStorage.getItem('accessToken');
+ const [isModalOpen, setIsModalOpen] = useState(false);
+ const [modalMessage, setModalMessage] = useState("");
+
+
const onClickReviewWrite = () => {
- navigate(`/clubs/${clubId}/review`, { state: { clubId, clubName } });
+ if (!isAdmin && token) {
+ navigate(`/clubs/${clubId}/review`, { state: { clubId, clubName } });
+ } else if (isAdmin && token){
+ setModalMessage('관리자는 리뷰를 작성할 수 없습니다.');
+ setIsModalOpen(true);
+ } else {
+ setModalMessage('리뷰 작성은 로그인 이후 가능합니다.');
+ setIsModalOpen(true);
+ }
};
+ const closeModal = () => {
+ setIsModalOpen(false);
+ setModalMessage("");
+ navigate(`/clubs/${clubId}`, { state: "Review" });
+ };
+
return (
@@ -24,6 +46,7 @@ export default function ReviewPage({ clubId, clubName }) {
+
);
}
diff --git a/src/component/detail/review/reviewBox.css b/src/component/detail/review/reviewBox.css
index 2a9f2ba..517cb20 100644
--- a/src/component/detail/review/reviewBox.css
+++ b/src/component/detail/review/reviewBox.css
@@ -38,7 +38,7 @@
display: flex;
flex-wrap: wrap;
gap: 7px;
- margin-top: 7px;
+ margin-top: 10px;
}
.keyword_container {
diff --git a/src/component/layout/Header.jsx b/src/component/layout/Header.jsx
index 35d6a22..1529f39 100644
--- a/src/component/layout/Header.jsx
+++ b/src/component/layout/Header.jsx
@@ -77,28 +77,30 @@ export default function Header() {
}
}, [accessToken, isAdmin]);
- const getNewToken = async () => {
- try {
- const res = await customAxios.post(
- `/v1/auths/refresh`,
- {},
- {
- token: refreshToken,
- }
- );
- const newAccessToken = res.data.data.accessToken;
- localStorage.setItem('accessToken', newAccessToken);
- // 새 토큰으로 다시 요청
- fetchUserData();
- } catch (error) {
- console.error('토큰 재발급 실패 : ', error);
- setModalMessage(error.response.data.reason);
- setIsModalOpen(true);
- localStorage.removeItem('accessToken');
- localStorage.removeItem('refreshToken');
- navigate('/login');
+ const getNewToken = async (isLogout = false) => {
+ try {
+ const res = await customAxios.post(
+ `/v1/auths/refresh`,
+ {},
+ {
+ token: refreshToken,
}
- };
+ );
+ const newAccessToken = res.data.data.accessToken;
+ localStorage.setItem('accessToken', newAccessToken);
+ // 새 토큰으로 다시 요청
+ fetchUserData();
+ } catch (error) {
+ console.error('토큰 재발급 실패 : ', error);
+ if (!isLogout) {
+ setModalMessage(error.response.data.reason);
+ setIsModalOpen(true);
+ }
+ localStorage.removeItem('accessToken');
+ localStorage.removeItem('refreshToken');
+ navigate('/login');
+ }
+ };
const handleUserContainerClick = () => {
if (!accessToken) {
@@ -125,51 +127,51 @@ export default function Header() {
return setMenuBarActive(menu);
};
- const handleLogout = async () => {
- try {
- console.log(isAdmin);
- if (isAdmin) {
- const res = await customAxios.post(
- '/v1/admins/logout',
- {},
- {
- headers: {
- Authorization: `Bearer ${accessToken}`,
- },
- }
- );
- console.log(res);
- localStorage.removeItem('accessToken'); // 로컬 스토리지에서 액세스 토큰 삭제
- localStorage.removeItem('refreshToken');
- localStorage.removeItem('adminId');
- localStorage.removeItem('isAdmin');
- } else {
- const res = await customAxios.post(
- '/v1/auths/logout',
- {},
- {
- headers: {
- Authorization: `Bearer ${accessToken}`,
- },
- }
- );
- console.log(res);
- localStorage.removeItem('accessToken'); // 로컬 스토리지에서 액세스 토큰 삭제
- localStorage.removeItem('refreshToken');
- localStorage.removeItem('adminId');
- localStorage.removeItem('isAdmin');
- }
- setShowLoginBox(false);
- // 로그아웃 이후 메인페이지 ? 로그인 페이지 ?
- navigate('/');
- } catch (error) {
- if (error.response && error.response.status === 401) {
- getNewToken();
- } else {
- console.error('로그아웃 실패:', error);
- }
- }
- };
+ const handleLogout = async () => {
+ try {
+ console.log(isAdmin);
+ if (isAdmin) {
+ const res = await customAxios.post(
+ '/v1/admins/logout',
+ {},
+ {
+ headers: {
+ Authorization: `Bearer ${accessToken}`,
+ },
+ }
+ );
+ console.log(res);
+ localStorage.removeItem('accessToken'); // 로컬 스토리지에서 액세스 토큰 삭제
+ localStorage.removeItem('refreshToken');
+ localStorage.removeItem('adminId');
+ localStorage.removeItem('isAdmin');
+ } else {
+ const res = await customAxios.post(
+ '/v1/auths/logout',
+ {},
+ {
+ headers: {
+ Authorization: `Bearer ${accessToken}`,
+ },
+ }
+ );
+ console.log(res);
+ localStorage.removeItem('accessToken'); // 로컬 스토리지에서 액세스 토큰 삭제
+ localStorage.removeItem('refreshToken');
+ localStorage.removeItem('adminId');
+ localStorage.removeItem('isAdmin');
+ }
+ setShowLoginBox(false);
+ // 로그아웃 이후 메인페이지 ? 로그인 페이지 ?
+ navigate('/');
+ } catch (error) {
+ if (error.response && error.response.status === 401) {
+ getNewToken();
+ } else {
+ console.error('로그아웃 실패:', error);
+ }
+ }
+ };
//동아리 검색 기능 관련
const handleInputChange = (event) => {
@@ -303,4 +305,4 @@ export default function Header() {
>
);
-}
+}
\ No newline at end of file
diff --git a/src/component/login/Login.jsx b/src/component/login/Login.jsx
index e48500a..4ad6109 100644
--- a/src/component/login/Login.jsx
+++ b/src/component/login/Login.jsx
@@ -1,5 +1,4 @@
import React, { useState } from 'react';
-import axios from 'axios';
import './login.css';
import { useNavigate } from 'react-router-dom';
import { customAxios } from '../../config/axios-config';
diff --git a/src/component/modal/ConfirmModal.jsx b/src/component/modal/ConfirmModal.jsx
new file mode 100644
index 0000000..59793a2
--- /dev/null
+++ b/src/component/modal/ConfirmModal.jsx
@@ -0,0 +1,35 @@
+import ReactModal from "react-modal";
+import "./modal.css";
+
+export default function ConfirmModal({ isOpen, message, onClickOk, onClose }) {
+ const customStyles = {
+ overlay: {
+ backgroundColor: "rgba(0, 0, 0, 0.5)"
+ },
+ content: {
+ width: "410px",
+ height: "150px",
+ margin: "auto",
+ borderRadius: "10px",
+ boxShadow: "0 2px 4px rgba(0,0,0,0.2)",
+ padding: "20px",
+ display: "flex",
+ flexDirection: "column",
+ justifyContent: "center",
+ alignItems: "center",
+ textAlign: "center"
+ }
+ }
+
+ return (
+
+
+ {message}
+
+
+
+
+
+
+ );
+}
\ No newline at end of file
diff --git a/src/component/modal/ErrorModal.jsx b/src/component/modal/ErrorModal.jsx
index b57d49b..ba67067 100644
--- a/src/component/modal/ErrorModal.jsx
+++ b/src/component/modal/ErrorModal.jsx
@@ -1,5 +1,5 @@
import ReactModal from "react-modal";
-import "./errorModal.css";
+import "./modal.css";
export default function ErrorModal({ isOpen, message, onClose }) {
const customStyles = {
diff --git a/src/component/modal/errorModal.css b/src/component/modal/errorModal.css
deleted file mode 100644
index b11994b..0000000
--- a/src/component/modal/errorModal.css
+++ /dev/null
@@ -1,12 +0,0 @@
-.ok_button {
- width: 101px;
- height: 40px;
- margin-top: 20px;
- border-radius: 5px;
- border: none;
- background-color: #7BC8E0;
- color: white;
- text-align: center;
- font-size: 15px;
- font-weight: 500;
-}
\ No newline at end of file
diff --git a/src/component/modal/modal.css b/src/component/modal/modal.css
new file mode 100644
index 0000000..6b1a052
--- /dev/null
+++ b/src/component/modal/modal.css
@@ -0,0 +1,32 @@
+.button_wrapper {
+ display: flex;
+ flex-direction: row;
+ justify-content: center;
+ gap: 10px;
+}
+
+.ok_button {
+ width: 101px;
+ height: 35px;
+ margin-top: 20px;
+ border-radius: 5px;
+ border: none;
+ background-color: #7BC8E0;
+ color: white;
+ text-align: center;
+ font-size: 15px;
+ font-weight: 500;
+}
+
+.cancel_button {
+ width: 101px;
+ height: 35px;
+ margin-top: 20px;
+ border-radius: 5px;
+ border: none;
+ background-color: #9C9C9C;
+ color: white;
+ text-align: center;
+ font-size: 15px;
+ font-weight: 500;
+}
\ No newline at end of file
diff --git a/src/component/mypage/review/myReview.css b/src/component/mypage/review/myReview.css
index 2b1abc9..0d7b91b 100644
--- a/src/component/mypage/review/myReview.css
+++ b/src/component/mypage/review/myReview.css
@@ -7,12 +7,25 @@
margin-bottom: 200px;
}
+ .club_review_container {
+ display: flex;
+ flex-direction: column;
+ margin: 50px 0px 200px 30px;
+ }
+
.my_review_container h2 {
- font-size: 24px;
+ font-size: 22px;
font-weight: 500px;
margin-bottom: 30px;
}
+ .club_review_container h2 {
+ font-size: 20px;
+ font-weight: 500px;
+ margin-bottom: 20px;
+ margin-left: 7px;
+ }
+
.my_review_box {
width: 475px;
background-color: white;
@@ -32,7 +45,7 @@
font-size: 14px;
font-weight: 700;
margin-right: 7px;
- margin-bottom: 2px;
+ margin-top: 3px;
color: #7BC8E0;
}
@@ -43,7 +56,6 @@
font-weight: 600px;
padding: 3px 7px;
margin-left: 10px;
- margin-bottom: 5px;
background-color: rgba(123, 200, 224, 0.15);
color: #7BC8E0;
}
@@ -55,7 +67,6 @@
font-weight: 600px;
padding: 3px 7px;
margin-left: 10px;
- margin-bottom: 5px;
background-color: #F2F2F2;
color: #00000060;
}
@@ -67,7 +78,6 @@
font-weight: 600px;
padding: 3px 7px;
margin-left: 10px;
- margin-bottom: 5px;
background-color: #fd3c561f;
color: #fd3c56b3;
}
@@ -82,12 +92,25 @@
margin-bottom: 200px;
}
+ .club_review_container {
+ display: flex;
+ flex-direction: column;
+ margin: 50px 0px 200px 30px;
+ }
+
.my_review_container h2 {
font-size: 24px;
font-weight: 500px;
margin-bottom: 30px;
}
+ .club_review_container h2 {
+ font-size: 20px;
+ font-weight: 500px;
+ margin-bottom: 20px;
+ margin-left: 7px;
+ }
+
.my_review_box {
width: 300px;
background-color: white;
diff --git a/src/config/axios-config.jsx b/src/config/axios-config.jsx
index d782d3f..42f2453 100644
--- a/src/config/axios-config.jsx
+++ b/src/config/axios-config.jsx
@@ -1,6 +1,6 @@
import axios from 'axios';
-//export const URL = 'http://localhost:8080';
+// export const URL = 'http://localhost:3000';
export const URL = 'http://13.125.141.171:8080';
//axios.defaults.withCredentials = true;
diff --git a/src/config/nav-config.jsx b/src/config/nav-config.jsx
deleted file mode 100644
index 8b13789..0000000
--- a/src/config/nav-config.jsx
+++ /dev/null
@@ -1 +0,0 @@
-