Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions src/api/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const deleteCookie = (name) => {
};

// 강제 로그아웃 처리 (refresh 실패 시)
const handleRefreshFailure = async () => {
const handleRefreshFailure = async (skipModal = false) => {
try {
// 1. 로그아웃 API 호출 (204 응답 확인)
const logoutResponse = await axios.post(
Expand Down Expand Up @@ -120,13 +120,21 @@ const handleRefreshFailure = async () => {
deleteCookie("RefreshToken");
deleteCookie("refresh_token");

// 4. 로그인 만료 모달 표시를 위한 커스텀 이벤트 발생
const event = new CustomEvent('showSessionExpiredModal', {
detail: {
message: "로그인 시간이 만료되었습니다. 재로그인해주세요"
}
});
window.dispatchEvent(event);
// 4. 로그인 만료 모달 표시를 위한 커스텀 이벤트 발생 (사용자가 직접 로그아웃한 경우 제외)
// 사용자가 직접 로그아웃한 경우 localStorage에 플래그가 설정되어 있음
const isManualLogout = localStorage.getItem("manualLogout") === "true";
if (!skipModal && !isManualLogout) {
const event = new CustomEvent('showSessionExpiredModal', {
detail: {
message: "로그인 시간이 만료되었습니다. 재로그인해주세요"
}
});
window.dispatchEvent(event);
}
// 플래그 제거
if (isManualLogout) {
localStorage.removeItem("manualLogout");
}

// 5. 로그인 페이지로 리다이렉트 (모달 닫힌 후 이동)
// 모달에서 처리하도록 주석 처리
Expand Down
49 changes: 49 additions & 0 deletions src/api/club.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import client from "./client";


export async function getClubList(pageable) {
const response = await client.get(`/api/v1/clubs`, {
params: pageable,
});
return response;
}

export async function postClubMemberJoin(clubId) {
const response = await client.post(`/api/v1/clubs/${clubId}/join`);
return response;
}

export async function getMyClubList(pageable) {
const response = await client.get("/api/v1/clubs/my", {
params: pageable,
});
return response;
}

export async function getClubMemberList(clubId, pageable) {
const response = await client.get(`/api/v1/clubs/${clubId}/members`, {
params: pageable,
});
return response;
}

export async function getClubJoinPendingList(clubId, pageable) {
const response = await client.get(`/api/v1/clubs/${clubId}/pending`, {
params: pageable,
});
return response;
}

export async function patchClubMemberJoinDecision(clubId, studentId, decision) {
const response = await client.patch(`/api/v1/clubs/${clubId}/members/${studentId}`, null, {
params: {
decision: decision,
},
});
return response;
}

export async function deleteClubWithdraw(clubId) {
const response = await client.delete(`/api/v1/clubs/${clubId}/withdraw`);
return response;
}
2 changes: 0 additions & 2 deletions src/api/mypage.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,13 @@ export async function getNickNameVerify(nickname) {
}

export async function getInquiryList(pageable) {
const accessToken = localStorage.getItem("accessToken");
const response = await client.get("/api/v1/inquiry/my", {
params: pageable,
});
return response;
}

export async function deleteInquiry(inquiryId) {
const accessToken = localStorage.getItem("accessToken");
const response = await client.delete(`/api/v1/inquiry/${inquiryId}`, {
});
return response;
Expand Down
3 changes: 3 additions & 0 deletions src/assets/images/clubIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions src/assets/images/expelIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/assets/images/outIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/components/chat/chatMessage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ export default function ChatMessage({ chatNickname, roomId, opponentProfileImage


<button className="bg-red-600 rounded-md p-2 text-white flex items-center gap-2" onClick={() => handleDeleteChatRoom(roomId)}>
<img src={outIcon} alt="outIcon" className="w-4 h-4" />
<img src={outIcon} alt="outIcon" className="w-4 h-4 brightness-0 invert" />
나가기
</button>
</div>
Expand All @@ -377,7 +377,7 @@ export default function ChatMessage({ chatNickname, roomId, opponentProfileImage
className="bg-red-600 rounded-md p-2 text-white flex items-center gap-2 text-sm"
onClick={() => handleDeleteChatRoom(roomId)}
>
<img src={outIcon} alt="outIcon" className="w-3 h-3" />
<img src={outIcon} alt="outIcon" className="w-3 h-3 brightness-0 invert" />
나가기
</button>
</div>
Expand Down
33 changes: 22 additions & 11 deletions src/components/header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ useEffect(() => {
setShowFeedAlertModal(true);
return false;
}
if (roleType !== "STUDENT" && roleType !== "ADMIN") {
if (roleType !== "STUDENT" && roleType !== "CLUB") {
setShowFeedAlertModal(true);
return false;
}
Expand Down Expand Up @@ -164,6 +164,9 @@ useEffect(() => {
};

const toggleLogin = () => {
// 사용자가 직접 로그아웃했음을 표시하는 플래그 설정
localStorage.setItem("manualLogout", "true");

UserStore.getState().clearUser();
localStorage.removeItem("isLogin");
localStorage.removeItem("userType");
Expand Down Expand Up @@ -401,7 +404,7 @@ const DesktopHeader = () => (
공고문 작성하기
</button>
)}
{roleType === "STUDENT" && (
{(roleType === "STUDENT" || roleType === "CLUB") && (
<button
className="block w-full px-4 py-2 text-md font-semibold text-gray-700 hover:text-blue-main"
onClick={() => handleNavigation("/postUpload")}
Expand Down Expand Up @@ -511,14 +514,22 @@ const DesktopHeader = () => (
>
마이페이지
</button>
<button
className="block w-full px-3 py-2 text-left text-gray-700"
onClick={() =>
handleNavigation(roleType === "MEMBER" ? "/recruitUpload" : "/postUpload")
}
>
{roleType === "MEMBER" ? "공고문 작성하기" : "피드 작성하기"}
</button>
{roleType === "MEMBER" && (
<button
className="block w-full px-3 py-2 text-left text-gray-700"
onClick={() => handleNavigation("/recruitUpload")}
>
공고문 작성하기
</button>
)}
{(roleType === "STUDENT" || roleType === "CLUB") && (
<button
className="block w-full px-3 py-2 text-left text-gray-700"
onClick={() => handleNavigation("/postUpload")}
>
피드 작성하기
</button>
)}
<button
className="block w-full px-3 py-2 text-left text-gray-700"
onClick={toggleLogin}
Expand Down Expand Up @@ -578,7 +589,7 @@ const DesktopHeader = () => (
<AlertModal
type="simple"
title="권한이 없습니다"
description="피드 등록은 학생 계정만 이용할 수 있습니다."
description="피드 등록은 학생 또는 동아리 계정만 이용할 수 있습니다."
TrueBtnText="로그인하러 가기"
FalseBtnText="취소"
onClickTrue={() => {
Expand Down
Loading