diff --git a/package-lock.json b/package-lock.json index d48ea6c..fa9f369 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,6 +13,7 @@ "@tailwindcss/vite": "^4.0.17", "axios": "^1.9.0", "date-fns": "^4.1.0", + "jwt-decode": "^4.0.0", "lucide-react": "^0.507.0", "react": "^19.0.0", "react-day-picker": "^9.6.7", @@ -3306,6 +3307,15 @@ "node": ">=6" } }, + "node_modules/jwt-decode": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jwt-decode/-/jwt-decode-4.0.0.tgz", + "integrity": "sha512-+KJGIyHgkGuIq3IEBNftfhW/LfWhXUIY6OmyVWjliu5KH1y0fw7VQ8YndE2O4qZdMSd9SqbnC8GOcZEy0Om7sA==", + "license": "MIT", + "engines": { + "node": ">=18" + } + }, "node_modules/keyv": { "version": "4.5.4", "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", diff --git a/package.json b/package.json index 1cf4fb1..71602ed 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "@tailwindcss/vite": "^4.0.17", "axios": "^1.9.0", "date-fns": "^4.1.0", + "jwt-decode": "^4.0.0", "lucide-react": "^0.507.0", "react": "^19.0.0", "react-day-picker": "^9.6.7", diff --git a/src/pages/Matching/MatchingArticlePage.tsx b/src/pages/Matching/MatchingArticlePage.tsx index 7a5fbcb..17eaf6b 100644 --- a/src/pages/Matching/MatchingArticlePage.tsx +++ b/src/pages/Matching/MatchingArticlePage.tsx @@ -226,8 +226,6 @@ export default function ArticleDetail() { {isCreatingChat ? "채팅방 생성 중..." : "채팅하기"} - - ); } diff --git a/src/pages/Matching/MatchingListPage.tsx b/src/pages/Matching/MatchingListPage.tsx index 554ff86..de980aa 100644 --- a/src/pages/Matching/MatchingListPage.tsx +++ b/src/pages/Matching/MatchingListPage.tsx @@ -1,11 +1,7 @@ // src/pages/Matching/MatchingListPage.tsx import { useState, useEffect, ReactNode } from "react"; -import { - useParams, - useNavigate, - useSearchParams, -} from "react-router-dom"; +import { useParams, useNavigate, useSearchParams } from "react-router-dom"; import axios from "axios"; import { getEnglishTeamName } from "../../hooks/TeamNameChanger"; @@ -13,25 +9,20 @@ import { getEnglishTeamName } from "../../hooks/TeamNameChanger"; // API DTOs interface MatchingPostDto { matchingPostIdx: number; - authorNickname: string; + nickname: string; // ← Swagger 예시에 맞춰 `nickname` title: string; context: string; haveTicket: boolean; isMatched: boolean; createdAt: string; } -interface MatchingListResponse { - posts: MatchingPostDto[]; - totalPages: number; - totalElements: number; -} -// Calendar API types + interface ApiGame { gameIdx: number; homeTeamName: string; awayTeamName: string; stadiumName: string; - startTime: string; // e.g. "13:00" + startTime: string; } interface CalendarGamesDay { day: number; @@ -103,22 +94,12 @@ export default function MatchingListPage() { setErrorMsg(null); axios - .get( - `/matching-post/by-game/${gameIdx}`, - { params: { page: currentPage - 1 } } - ) + .get(`/matching-post/by-game/${gameIdx}`, { + params: { page: currentPage - 1 }, + }) .then((res) => { - const data = res.data; - if (Array.isArray(data)) { - setListData(data); - setTotalPages(1); - } else if ("posts" in data) { - setListData(data.posts); - setTotalPages(data.totalPages); - } else { - setListData([]); - setTotalPages(1); - } + setListData(res.data); + setTotalPages(1); }) .catch(() => { setErrorMsg("게시글을 불러오는 중 오류가 발생했습니다."); @@ -157,7 +138,7 @@ export default function MatchingListPage() { return (
- {/* ─── 상단: 경기 로고 + VS + 시간 ───────────────────────── */} + {/* 상단: 경기 로고 + VS + 시간 */} {selectedGame && (
@@ -183,7 +164,7 @@ export default function MatchingListPage() {
)} - {/* ─── 필터 / 검색 / 제안 버튼 ─────────────────────────────── */} + {/* 필터 / 검색 / 제안 버튼 */}