From fd1890dfc8858882dc5ec3851fd557e7902cbf2d Mon Sep 17 00:00:00 2001
From: llddang <77055208+llddang@users.noreply.github.com>
Date: Thu, 24 Oct 2024 15:39:28 +0900
Subject: [PATCH] =?UTF-8?q?Feature/#222=20=EB=A7=88=EC=9D=BC=EC=8A=A4?=
 =?UTF-8?q?=ED=86=A4=20=EB=AA=A9=EB=A1=9D=ED=8E=98=EC=9D=B4=EC=A7=80?=
 =?UTF-8?q?=EC=97=90=EC=84=9C=20=ED=8E=98=EC=9D=B4=EC=A7=80=EB=84=A4?=
 =?UTF-8?q?=EB=B9=84=EA=B2=8C=EC=9D=B4=EC=85=98=EC=97=90=20=EA=B2=80?=
 =?UTF-8?q?=EC=83=89=ED=95=84=ED=84=B0=20=EC=A0=81=EC=9A=A9=20(#224)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* feat: 마일스톤 목록페이지에서 쿼리 적용

* refactor: 사용하지 않는 임포트 구문 삭제

* feat: 마일스톤 랭킹 페이지에서 페이지 네이션 동작하도록 수정

* feat: 배포 시 콘솔 로그 안 나오도록 수정
---
 frontend/next.config.mjs                       | 6 ++++++
 frontend/src/app/admin/milestone/list/page.tsx | 9 ++++++---
 frontend/src/app/admin/milestone/rank/page.tsx | 8 +++++---
 3 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/frontend/next.config.mjs b/frontend/next.config.mjs
index 3b4cd057..e2b7bfd6 100644
--- a/frontend/next.config.mjs
+++ b/frontend/next.config.mjs
@@ -9,4 +9,10 @@ const nextConfig = {
   },
 };
 
+if (process.env.NEXT_PUBLIC_NODE_ENV === 'prod') {
+  nextConfig.compiler = {
+    removeConsole: true,
+  };
+}
+
 export default nextConfig;
diff --git a/frontend/src/app/admin/milestone/list/page.tsx b/frontend/src/app/admin/milestone/list/page.tsx
index 8abc9ffb..7120f81f 100644
--- a/frontend/src/app/admin/milestone/list/page.tsx
+++ b/frontend/src/app/admin/milestone/list/page.tsx
@@ -10,8 +10,6 @@ import MilestoneHistoryTable from './components/MilestoneHistoryTable';
 import MilestoneHistoryExcelFileDownloadButton from './components/MilestoneHistoryTable/MilestoneHistoryExcelFileDownloadButton.tsx';
 import { AuthSliceState } from '@/store/auth.slice';
 import { getAuthFromCookie } from '@/lib/utils/auth';
-import { BusinessError } from '@/types/error';
-import { redirect } from 'next/navigation';
 
 const Page = async ({ searchParams }: { searchParams?: { [key: string]: string | undefined } }) => {
   const headersList = headers();
@@ -47,7 +45,12 @@ const Page = async ({ searchParams }: { searchParams?: { [key: string]: string |
       <div className="flex justify-end">
         <MilestoneHistoryExcelFileDownloadButton field={field} keyword={keyword} />
       </div>
-      <Pagination currentPage={page} totalItems={milestoneHistories?.totalElements || 0} pathname={pathname} />
+      <Pagination
+        currentPage={page}
+        totalItems={milestoneHistories?.totalElements || 0}
+        pathname={pathname}
+        query={JSON.stringify({ field, keyword })}
+      />
     </div>
   );
 };
diff --git a/frontend/src/app/admin/milestone/rank/page.tsx b/frontend/src/app/admin/milestone/rank/page.tsx
index aab31f4e..a933de12 100644
--- a/frontend/src/app/admin/milestone/rank/page.tsx
+++ b/frontend/src/app/admin/milestone/rank/page.tsx
@@ -7,7 +7,7 @@
 'use client';
 
 import { DateTime } from 'luxon';
-import { usePathname } from 'next/navigation';
+import { usePathname, useSearchParams } from 'next/navigation';
 import { useMemo, useState } from 'react';
 
 import Pagination from '@/adminComponents/Pagination';
@@ -19,14 +19,16 @@ import { convertMilestoneGroup } from '@/lib/utils/utils';
 import { Period } from '@/types/common';
 import { toast } from 'react-toastify';
 
-const Page = ({ searchParams }: { searchParams?: { [key: string]: string | undefined } }) => {
+const Page = () => {
   const [filterPeriod, setFilterPeriod] = useState<Period>({
     startDate: DateTime.now().minus({ years: 1 }).toFormat('yyyy-MM-dd'),
     endDate: DateTime.now().toFormat('yyyy-MM-dd'),
   });
   const [searchFilterPeriod, setSearchFilterPeriod] = useState<Period>(filterPeriod);
+  const searchParams = useSearchParams();
   const pathname = usePathname();
-  const page = searchParams?.page ? parseInt(searchParams.page, 10) : 1;
+  const page = parseInt(searchParams.get('page') || '1', 10);
+  console.log(page);
 
   const { data: excelFile } = useMilestoneHistoryScoreExcelFileQuery(
     searchFilterPeriod.startDate,