diff --git a/frontend/src/components/AdminRoute.tsx b/frontend/src/components/AdminRoute.tsx deleted file mode 100644 index c238090d..00000000 --- a/frontend/src/components/AdminRoute.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import React from 'react'; -import {Navigate, useLocation} from 'react-router-dom'; -import {useAuth} from '../context/AuthContext'; - -const AdminRoute: React.FC<{ children: JSX.Element }> = ({ children }) => { - const { loggedIn, role, loading } = useAuth(); - const location = useLocation(); - - if (loading) { - return
Loading...
; // Or a proper spinner component - } - - if (!loggedIn) { - // Not logged in, redirect to login page. No alert needed here - // as the user is simply redirected. - return ; - } - - if (role !== 'ADMIN') { - // Logged in but not an admin, show alert and redirect. - alert('접근 권한이 없어요. 관리자에게 문의해주세요.'); - return ; - } - - return children; -}; - -export default AdminRoute; diff --git a/frontend/src/pages/admin/AdminSchedulePage.tsx b/frontend/src/pages/admin/AdminSchedulePage.tsx index f169e0bc..1e169177 100644 --- a/frontend/src/pages/admin/AdminSchedulePage.tsx +++ b/frontend/src/pages/admin/AdminSchedulePage.tsx @@ -1,5 +1,5 @@ -import {isLoginRequiredError} from '@_api/apiClient'; -import type {AuditInfo} from '@_api/common/commonTypes'; +import { isLoginRequiredError } from '@_api/apiClient'; +import type { AuditInfo } from '@_api/common/commonTypes'; import { createSchedule, deleteSchedule, @@ -7,15 +7,15 @@ import { fetchScheduleAudit, updateSchedule } from '@_api/schedule/scheduleAPI'; -import {type AdminScheduleSummaryResponse, ScheduleStatus,} from '@_api/schedule/scheduleTypes'; -import {getStores} from '@_api/store/storeAPI'; -import {type SimpleStoreResponse} from '@_api/store/storeTypes'; -import {fetchActiveThemes, fetchThemeById} from '@_api/theme/themeAPI'; -import {DifficultyKoreanMap, type SimpleActiveThemeResponse, type ThemeInfoResponse} from '@_api/theme/themeTypes'; -import {useAdminAuth} from '@_context/AdminAuthContext'; +import { type AdminScheduleSummaryResponse, ScheduleStatus, } from '@_api/schedule/scheduleTypes'; +import { getStores } from '@_api/store/storeAPI'; +import { type SimpleStoreResponse } from '@_api/store/storeTypes'; +import { fetchActiveThemes } from '@_api/theme/themeAPI'; +import { DifficultyKoreanMap, type SimpleActiveThemeResponse, type ThemeInfoResponse } from '@_api/theme/themeTypes'; +import { useAdminAuth } from '@_context/AdminAuthContext'; import '@_css/admin-schedule-page.css'; -import React, {Fragment, useEffect, useState} from 'react'; -import {useLocation, useNavigate} from 'react-router-dom'; +import React, { Fragment, useEffect, useState } from 'react'; +import { useLocation, useNavigate } from 'react-router-dom'; const getScheduleStatusText = (status: ScheduleStatus): string => { switch (status) { @@ -53,8 +53,8 @@ const AdminSchedulePage: React.FC = () => { const [editingSchedule, setEditingSchedule] = useState(null); const [isModalOpen, setIsModalOpen] = useState(false); - const [selectedThemeDetails, setSelectedThemeDetails] = useState(null); - const [isLoadingThemeDetails, setIsLoadingThemeDetails] = useState(false); + const [selectedThemeDetails] = useState(null); + const [isLoadingThemeDetails] = useState(false); const navigate = useNavigate(); const location = useLocation(); diff --git a/frontend/tsconfig.app.json b/frontend/tsconfig.app.json index 0edfa51c..4970e0b4 100644 --- a/frontend/tsconfig.app.json +++ b/frontend/tsconfig.app.json @@ -19,7 +19,6 @@ "strict": true, "noUnusedLocals": true, "noUnusedParameters": true, - "erasableSyntaxOnly": true, "noFallthroughCasesInSwitch": true, "noUncheckedSideEffectImports": true,