access_token 쿠키 확인하여 로그인 상태 유지 처리

ProtectedRoute 로 로그인 필요 페이지 접근 관리
import 문을 src/ 포함된 절대경로로 개선
This commit is contained in:
2026-01-02 11:21:56 +09:00
parent 985ba75d34
commit 767435cad4
19 changed files with 125 additions and 156 deletions

View File

@@ -1,10 +1,10 @@
import { useContext } from 'react';
import { AuthContext } from '../context/AuthContext';
import { AuthContext, AuthContextType } from 'src/context/AuthContext';
export const useAuth = () => {
export const useAuth = (): AuthContextType => {
const context = useContext(AuthContext);
if (context === undefined) {
if (!context) {
throw new Error('useAuth must be used within an AuthProvider');
}