From 526598a24f96b0be3edf7aee2605beb6fa73770f Mon Sep 17 00:00:00 2001 From: pricelees Date: Wed, 30 Jul 2025 15:45:00 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20frontend=EC=97=90=EC=84=9C=EC=9D=98=20?= =?UTF-8?q?=EB=B9=8C=EB=93=9C=20=EC=98=A4=EB=A5=98=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/Layout.tsx | 2 +- frontend/src/components/Navbar.tsx | 5 ++--- frontend/src/context/AuthContext.tsx | 6 +++--- frontend/src/pages/admin/AdminLayout.tsx | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/frontend/src/components/Layout.tsx b/frontend/src/components/Layout.tsx index 9c736580..e4440f76 100644 --- a/frontend/src/components/Layout.tsx +++ b/frontend/src/components/Layout.tsx @@ -1,4 +1,4 @@ -import React, { ReactNode } from 'react'; +import React, { type ReactNode } from 'react'; import Navbar from './Navbar'; interface LayoutProps { diff --git a/frontend/src/components/Navbar.tsx b/frontend/src/components/Navbar.tsx index 83c75a2c..6d6a324d 100644 --- a/frontend/src/components/Navbar.tsx +++ b/frontend/src/components/Navbar.tsx @@ -1,12 +1,11 @@ -import { checkLogin } from '@_api/auth/authAPI'; -import React, { useEffect, useState } from 'react'; +import React from 'react'; import { Link, useNavigate } from 'react-router-dom'; import { useAuth } from 'src/context/AuthContext'; const Navbar: React.FC = () => { const { loggedIn, userName, logout } = useAuth(); const navigate = useNavigate(); - + const handleLogout = async (e: React.MouseEvent) => { e.preventDefault(); try { diff --git a/frontend/src/context/AuthContext.tsx b/frontend/src/context/AuthContext.tsx index b4e83a61..c367b18f 100644 --- a/frontend/src/context/AuthContext.tsx +++ b/frontend/src/context/AuthContext.tsx @@ -1,13 +1,13 @@ -import React, { createContext, useState, useEffect, ReactNode, useContext } from 'react'; import { checkLogin as apiCheckLogin, login as apiLogin, logout as apiLogout } from '@_api/auth/authAPI'; -import type { LoginRequest, LoginCheckResponse } from '@_api/auth/authTypes'; +import type { LoginRequest, LoginResponse } from '@_api/auth/authTypes'; +import React, { createContext, useContext, useEffect, useState, type ReactNode } from 'react'; interface AuthContextType { loggedIn: boolean; userName: string | null; role: 'ADMIN' | 'MEMBER' | null; loading: boolean; // Add loading state to type - login: (data: LoginRequest) => Promise; + login: (data: LoginRequest) => Promise; logout: () => Promise; checkLogin: () => Promise; } diff --git a/frontend/src/pages/admin/AdminLayout.tsx b/frontend/src/pages/admin/AdminLayout.tsx index 26987dbe..47034a06 100644 --- a/frontend/src/pages/admin/AdminLayout.tsx +++ b/frontend/src/pages/admin/AdminLayout.tsx @@ -1,4 +1,4 @@ -import React, { ReactNode } from 'react'; +import React, { type ReactNode } from 'react'; import AdminNavbar from './AdminNavbar'; interface AdminLayoutProps {