diff --git a/frontend/src/app/admin/milestone/list/[slug]/page.tsx b/frontend/src/app/admin/milestone/list/[slug]/page.tsx index 65d3073b..92ea9b8e 100644 --- a/frontend/src/app/admin/milestone/list/[slug]/page.tsx +++ b/frontend/src/app/admin/milestone/list/[slug]/page.tsx @@ -97,6 +97,12 @@ const Page = async ({ params: { slug } }: MilestoneHistoryDetailPageProps) => { 승인 상태 {convertMilestoneHistoryStatus(history.status)}

+ {history.rejectReason && ( +

+ 반려 이유 + {history.rejectReason} +

+ )} diff --git a/frontend/src/app/admin/milestone/list/page.tsx b/frontend/src/app/admin/milestone/list/page.tsx index af521a30..8abc9ffb 100644 --- a/frontend/src/app/admin/milestone/list/page.tsx +++ b/frontend/src/app/admin/milestone/list/page.tsx @@ -10,6 +10,8 @@ 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(); @@ -21,7 +23,12 @@ const Page = async ({ searchParams }: { searchParams?: { [key: string]: string | const field = searchParams?.field ? parseInt(searchParams.field, 10) : 0; const keyword = searchParams?.keyword ? searchParams.keyword : ''; - const milestoneHistories = await getMilestoneHistories(auth.token, field, keyword, page - 1); + let milestoneHistories; + try { + milestoneHistories = await getMilestoneHistories(auth.token, field, keyword, page - 1); + } catch (err) { + // TODO: server api error handling... + } return (
diff --git a/frontend/src/lib/api/server.api.ts b/frontend/src/lib/api/server.api.ts index 81023286..cd95202b 100644 --- a/frontend/src/lib/api/server.api.ts +++ b/frontend/src/lib/api/server.api.ts @@ -13,6 +13,7 @@ import { MilestoneHistorySortCriteria, SortDirection } from '@/types/milestone'; import { mockHackathonPrize } from '@/mocks/hackathon'; import { removeEmptyField } from '../utils/utils'; +import { BusinessError } from '@/types/error'; export async function getMilestoneHistoriesOfStudent( token: string, @@ -60,7 +61,10 @@ export async function getMilestoneHistories( }), }) .then((res) => res.data) - .catch((err) => Promise.reject(err)); + .catch((err) => { + location.replace('/sign-out'); + return Promise.reject(err); + }); } export async function getMilestoneHistory(historyId: number, token: string) { diff --git a/frontend/src/types/error.ts b/frontend/src/types/error.ts index 53e666e2..20798dae 100644 --- a/frontend/src/types/error.ts +++ b/frontend/src/types/error.ts @@ -20,7 +20,7 @@ export class BusinessError extends Error { super(); this.originalError = error; this.name = 'BusinessError'; - this.message = message ? message : 'MemberRoleNotMatchedError'; + this.message = message ? message : 'BusinessError'; } } @@ -28,7 +28,7 @@ export class AuthError extends BusinessError { constructor(error?: AxiosError, message?: string) { super(error, message); this.name = 'AuthError'; - this.message = message ? message : 'MemberRoleNotMatchedError'; + this.message = message ? message : 'AuthError'; } } @@ -36,7 +36,7 @@ export class NotFoundError extends AuthError { constructor(error?: AxiosError, message?: string) { super(error, message); this.name = 'NotFoundError'; - this.message = message ? message : 'MemberRoleNotMatchedError'; + this.message = message ? message : 'NotFoundError'; } } @@ -44,7 +44,7 @@ export class AccessDeniedError extends AuthError { constructor(error?: AxiosError, message?: string) { super(error, message); this.name = 'AccessDeniedError'; - this.message = message ? message : 'MemberRoleNotMatchedError'; + this.message = message ? message : 'AccessDeniedError'; } } @@ -52,7 +52,7 @@ export class UnauthorizedError extends AuthError { constructor(error?: AxiosError, message?: string) { super(error, message); this.name = 'UnauthorizedError'; - this.message = message ? message : 'MemberRoleNotMatchedError'; + this.message = message ? message : 'UnauthorizedError'; } }