From e3925415f3a7e31cf594f0996749e2bab06ebfad Mon Sep 17 00:00:00 2001 From: hyoseok Date: Wed, 25 Mar 2026 10:02:45 +0900 Subject: [PATCH 1/2] =?UTF-8?q?refactor:=20=ED=94=84=EB=9F=B0=ED=8A=B8=20A?= =?UTF-8?q?PI=20=EA=B3=84=EC=95=BD=20=ED=83=80=EC=9E=85=20=EB=8B=A8?= =?UTF-8?q?=EC=9D=BC=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - API 응답 계약 기준을 src/shared/types/api.ts로 통합 - validations.ts의 API 응답 중복 선언 제거 - ranking user auth 소비자를 backend OpenAPI 기준에 맞춤 --- src/app/auth/callback/page.tsx | 3 +- src/app/oauth2/redirect/page.tsx | 3 +- src/app/ranking/page.tsx | 12 ++-- src/app/sitemap.ts | 59 ++++++++------------ src/app/users/[username]/opengraph-image.tsx | 29 ++++------ src/shared/constants/tier-styles.ts | 7 +-- src/shared/lib/api-client.ts | 13 +---- src/shared/lib/validations.ts | 51 ----------------- src/shared/types/api.ts | 48 +++++++++------- 9 files changed, 74 insertions(+), 151 deletions(-) diff --git a/src/app/auth/callback/page.tsx b/src/app/auth/callback/page.tsx index 54b603d..458492e 100644 --- a/src/app/auth/callback/page.tsx +++ b/src/app/auth/callback/page.tsx @@ -13,6 +13,7 @@ import { Loader2, AlertCircle, RefreshCcw } from "lucide-react" import { motion, AnimatePresence } from "framer-motion" import Link from "next/link" import { useI18n } from "@/shared/providers/locale-provider" +import type { AuthMeResponse } from "@/shared/types/api" function RedirectHandler() { const { t } = useI18n() @@ -46,7 +47,7 @@ function RedirectHandler() { hasCalledRef.current = true // 쿠키는 이미 Set-Cookie로 설정되어 있으므로, /auth/me로 사용자 식별 후 전체 정보 조회 - apiClient.get('/auth/me') + apiClient.get('/auth/me') .then(({ username }) => getUser(username)) .then((user) => { login(user) diff --git a/src/app/oauth2/redirect/page.tsx b/src/app/oauth2/redirect/page.tsx index 2128b14..c967aa3 100644 --- a/src/app/oauth2/redirect/page.tsx +++ b/src/app/oauth2/redirect/page.tsx @@ -13,6 +13,7 @@ import { Loader2, AlertCircle, RefreshCcw } from "lucide-react" import { motion, AnimatePresence } from "framer-motion" import Link from "next/link" import { useI18n } from "@/shared/providers/locale-provider" +import type { AuthMeResponse } from "@/shared/types/api" function RedirectHandler() { const { t } = useI18n() @@ -46,7 +47,7 @@ function RedirectHandler() { hasCalledRef.current = true // 쿠키는 이미 Set-Cookie로 설정되어 있으므로, /auth/me로 사용자 식별 후 전체 정보 조회 - apiClient.get('/auth/me') + apiClient.get('/auth/me') .then(({ username }) => getUser(username)) .then((user) => { login(user) diff --git a/src/app/ranking/page.tsx b/src/app/ranking/page.tsx index fe5087c..86382b4 100644 --- a/src/app/ranking/page.tsx +++ b/src/app/ranking/page.tsx @@ -4,7 +4,7 @@ import { useState, Suspense, useRef } from "react" import { useRouter, useSearchParams } from "next/navigation" import { LazyMotion, domAnimation, m } from "framer-motion" import { useRankingList } from "@/features/ranking/api/ranking-service" -import { Tier } from "@/shared/types/api" +import { Tier, TIER_VALUES } from "@/shared/types/api" import { getTierBadgeStyle, getTierDotColor } from "@/shared/constants/tier-styles" import { Avatar, AvatarFallback, AvatarImage } from "@/shared/components/avatar" import { Skeleton } from "@/shared/components/skeleton" @@ -15,10 +15,7 @@ import { ChevronLeft, ChevronRight, ChevronsLeft, ChevronsRight, Search, Crown, import { cn } from "@/shared/lib/utils" import { useI18n } from "@/shared/providers/locale-provider" -const TIERS: (Tier | 'ALL')[] = [ - 'ALL', 'CHALLENGER', 'MASTER', 'DIAMOND', 'EMERALD', - 'PLATINUM', 'GOLD', 'SILVER', 'BRONZE', 'IRON' -] +const TIER_FILTERS: ReadonlyArray = ['ALL', ...TIER_VALUES] // [Component] Toolbar function RankingToolbar({ @@ -32,7 +29,7 @@ function RankingToolbar({
- {TIERS.map((tier) => ( + {TIER_FILTERS.map((tier) => (