optimize boot sequnse

This commit is contained in:
hansoo
2025-03-19 07:27:10 +09:00
parent ab3bcbdc63
commit 2ec913c6c0
12 changed files with 224 additions and 180 deletions

View File

@@ -0,0 +1,17 @@
import { useContext, createContext } from 'react';
import { AuthContextType } from './types';
// AuthContext 생성
export const AuthContext = createContext<AuthContextType | undefined>(undefined);
/**
* 인증 컨텍스트에 접근하기 위한 커스텀 훅
* AuthProvider 내부에서만 사용해야 함
*/
export const useAuth = () => {
const context = useContext(AuthContext);
if (context === undefined) {
throw new Error('useAuth는 AuthProvider 내부에서 사용해야 합니다');
}
return context;
};