Spaces:
Sleeping
Sleeping
| const SESSION_KEY = "repex_session_id"; | |
| export function getStoredSessionId(): string { | |
| return localStorage.getItem(SESSION_KEY) || ""; | |
| } | |
| export function setStoredSessionId(id: string): void { | |
| if (!id) return; | |
| localStorage.setItem(SESSION_KEY, id); | |
| } | |
| export function clearStoredSessionId(): void { | |
| localStorage.removeItem(SESSION_KEY); | |
| } | |
| export function getSessionIdFromSearch(search: string): string { | |
| const params = new URLSearchParams(search); | |
| return params.get("session") || ""; | |
| } | |
| export function getSessionId(search: string): string { | |
| return getSessionIdFromSearch(search) || getStoredSessionId(); | |
| } | |
| export function buildSessionQuery(sessionId: string): string { | |
| return sessionId ? `?session=${encodeURIComponent(sessionId)}` : ""; | |
| } | |