jwt 로그인 구현 진행 : axios 로 api 호출하여 생성된 쿠키로 인증상태값 변경기능 구현

This commit is contained in:
2025-12-31 19:39:42 +09:00
parent fd40ce5e75
commit 985ba75d34
12 changed files with 340 additions and 35 deletions

12
src/hooks/useAuth.ts Normal file
View File

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