refactor: FSD 구조 강화 및 파일 500줄 제한에 따른 대규모 리팩토링
- SpaceWorkspaceWidget 로직을 전용 훅 및 유틸리티로 분리 (900줄 -> 300줄) - useSpaceWorkspaceSelection 훅을 기능별(영속성, 진단 등) 소형 훅으로 분리 - SpaceToolsDockWidget의 상태 및 핸들러 로직 추출 - 거대 i18n 번역 파일(ko.ts)을 도메인별 메시지 파일로 구조화 - AdminConsoleWidget 누락분 추가 및 미디어 엔티티 타입 오류 수정
This commit is contained in:
35
src/widgets/admin-console/model/sessionStorage.ts
Normal file
35
src/widgets/admin-console/model/sessionStorage.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import type { AuthResponse } from '@/entities/auth';
|
||||
|
||||
const ADMIN_STORAGE_KEY = 'vr_admin_session';
|
||||
|
||||
export const readStoredSession = (): AuthResponse | null => {
|
||||
if (typeof window === 'undefined') {
|
||||
return null;
|
||||
}
|
||||
|
||||
const rawValue = window.localStorage.getItem(ADMIN_STORAGE_KEY);
|
||||
|
||||
if (!rawValue) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
return JSON.parse(rawValue) as AuthResponse;
|
||||
} catch {
|
||||
window.localStorage.removeItem(ADMIN_STORAGE_KEY);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
export const storeSession = (session: AuthResponse | null) => {
|
||||
if (typeof window === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!session) {
|
||||
window.localStorage.removeItem(ADMIN_STORAGE_KEY);
|
||||
return;
|
||||
}
|
||||
|
||||
window.localStorage.setItem(ADMIN_STORAGE_KEY, JSON.stringify(session));
|
||||
};
|
||||
Reference in New Issue
Block a user