- SpaceWorkspaceWidget 로직을 전용 훅 및 유틸리티로 분리 (900줄 -> 300줄) - useSpaceWorkspaceSelection 훅을 기능별(영속성, 진단 등) 소형 훅으로 분리 - SpaceToolsDockWidget의 상태 및 핸들러 로직 추출 - 거대 i18n 번역 파일(ko.ts)을 도메인별 메시지 파일로 구조화 - AdminConsoleWidget 누락분 추가 및 미디어 엔티티 타입 오류 수정
36 lines
770 B
TypeScript
36 lines
770 B
TypeScript
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));
|
|
};
|