refactor(WEB): 레이아웃 및 설정 관리 개선
- AuthenticatedLayout: FCM 통합 및 레이아웃 개선 - logout: 로그아웃 시 FCM 토큰 정리 로직 추가 - AccountInfoManagement: 계정 정보 관리 UI 개선 - not-found 페이지 스타일 개선 - 환경변수 예시 파일 업데이트
This commit is contained in:
@@ -5,7 +5,8 @@
|
||||
* 1. Zustand 스토어 초기화 (메모리 캐시)
|
||||
* 2. sessionStorage 캐시 삭제 (page_config_*, mes-*)
|
||||
* 3. localStorage 사용자 데이터 삭제 (mes-currentUser, mes-users)
|
||||
* 4. 서버 로그아웃 API 호출 (HttpOnly 쿠키 삭제)
|
||||
* 4. FCM 토큰 해제 (Capacitor 네이티브 앱)
|
||||
* 5. 서버 로그아웃 API 호출 (HttpOnly 쿠키 삭제)
|
||||
*
|
||||
* @see claudedocs/security/[PLAN-2025-12-12] tenant-data-isolation-implementation.md
|
||||
*/
|
||||
@@ -13,6 +14,8 @@
|
||||
import { useMasterDataStore } from '@/stores/masterDataStore';
|
||||
import { useItemStore } from '@/stores/itemStore';
|
||||
|
||||
// FCM은 Capacitor 환경에서만 사용 (동적 import로 웹 빌드 에러 방지)
|
||||
|
||||
// ===== 캐시 삭제 대상 Prefix =====
|
||||
|
||||
const SESSION_STORAGE_PREFIXES = [
|
||||
@@ -144,7 +147,8 @@ export async function callLogoutAPI(): Promise<boolean> {
|
||||
* 1. Zustand 스토어 초기화 (즉시 UI 반영)
|
||||
* 2. sessionStorage 캐시 삭제
|
||||
* 3. localStorage 사용자 데이터 삭제
|
||||
* 4. 서버 로그아웃 API 호출
|
||||
* 4. FCM 토큰 해제 (Capacitor 네이티브 앱)
|
||||
* 5. 서버 로그아웃 API 호출
|
||||
*
|
||||
* @param options.skipServerLogout - 서버 로그아웃 생략 여부 (기본: false)
|
||||
* @param options.redirectTo - 로그아웃 후 리다이렉트 경로 (기본: null)
|
||||
@@ -168,14 +172,27 @@ export async function performFullLogout(options?: {
|
||||
// 3. localStorage 사용자 데이터 삭제
|
||||
clearLocalStorageCache();
|
||||
|
||||
// 4. 서버 로그아웃 API 호출 (HttpOnly 쿠키 삭제)
|
||||
// 4. FCM 토큰 해제 (Capacitor 네이티브 앱에서만 실행)
|
||||
// 동적 import로 @capacitor/core 빌드 에러 방지
|
||||
try {
|
||||
const fcm = await import('@/lib/capacitor/fcm');
|
||||
if (fcm.isCapacitorNative()) {
|
||||
await fcm.unregisterFCMToken();
|
||||
console.log('[Logout] FCM token unregistered');
|
||||
}
|
||||
} catch {
|
||||
// Capacitor 모듈이 없는 환경 (웹) - 무시
|
||||
console.log('[Logout] Skipping FCM (not in native app)');
|
||||
}
|
||||
|
||||
// 5. 서버 로그아웃 API 호출 (HttpOnly 쿠키 삭제)
|
||||
if (!skipServerLogout) {
|
||||
await callLogoutAPI();
|
||||
}
|
||||
|
||||
console.log('[Logout] Full logout completed successfully');
|
||||
|
||||
// 5. 리다이렉트 (선택적)
|
||||
// 6. 리다이렉트 (선택적)
|
||||
if (redirectTo && typeof window !== 'undefined') {
|
||||
window.location.href = redirectTo;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user