TASK-036: admin/layout.tsx API Key UI 완전 제거 TASK-037: adminFetch JWT 전용 단순화 (api key fallback 제거) TASK-038: ApiKeyStrategy, ApiKeyGuard, CompositeGuard 제거 - api-key.strategy.ts, api-key.guard.ts 파일 삭제 - 모든 컨트롤러 @UseGuards JwtGuard로 전환 - AuthModule에서 ApiKey 관련 providers 제거 TASK-039: PUBLIC_PATHS에서 /register 제거, login FooterLink dead code 제거 테스트 23/23 pass, FE 16 routes build 성공
21 lines
655 B
TypeScript
21 lines
655 B
TypeScript
/**
|
|
* 관리자 API 호출 유틸 — JWT 전용.
|
|
* 로그인 후 localStorage의 access token을 Authorization 헤더에 설정한다.
|
|
*/
|
|
export function getAdminToken(): string {
|
|
if (typeof window === 'undefined') return '';
|
|
return localStorage.getItem('hanarang_access_token') ?? '';
|
|
}
|
|
|
|
export function adminFetch(path: string, options?: RequestInit) {
|
|
const token = getAdminToken();
|
|
|
|
const headers: Record<string, string> = {
|
|
'Content-Type': 'application/json',
|
|
...(options?.headers as Record<string, string> ?? {}),
|
|
...(token ? { Authorization: `Bearer ${token}` } : {}),
|
|
};
|
|
|
|
return fetch(path, { ...options, headers });
|
|
}
|