- shared/auth 모듈: AuthProvider, ProtectedRoute, useAuth, authApi - 페이지: LoginPage(Google OAuth), PendingPage, DeniedPage - WING_PERMIT 역할 기반 접근 제어 - Topbar에 사용자 이름 + 로그아웃 버튼 추가 - App.tsx에 react-router 라우팅 + AuthProvider 래핑 - DEV 모드 Mock 로그인 지원 (김개발) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
20 lines
433 B
TypeScript
20 lines
433 B
TypeScript
import { createContext } from 'react';
|
|
import type { User } from './types';
|
|
|
|
export interface AuthContextValue {
|
|
user: User | null;
|
|
token: string | null;
|
|
loading: boolean;
|
|
login: (googleToken: string) => Promise<void>;
|
|
devLogin?: () => void;
|
|
logout: () => void;
|
|
}
|
|
|
|
export const AuthContext = createContext<AuthContextValue>({
|
|
user: null,
|
|
token: null,
|
|
loading: true,
|
|
login: async () => {},
|
|
logout: () => {},
|
|
});
|