access_token 쿠키 확인하여 로그인 상태 유지 처리
ProtectedRoute 로 로그인 필요 페이지 접근 관리 import 문을 src/ 포함된 절대경로로 개선
This commit is contained in:
@@ -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');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user