22 lines
650 B
TypeScript
22 lines
650 B
TypeScript
export const selectedAppStorageKey = 'studio-admin:selected-app-id';
|
|
const legacySelectedAppStorageKey = 'studio-selected-app-id';
|
|
|
|
export function getStoredSelectedAppId() {
|
|
const current = window.localStorage.getItem(selectedAppStorageKey);
|
|
if (current) return current;
|
|
|
|
const legacy = window.localStorage.getItem(legacySelectedAppStorageKey);
|
|
if (legacy) {
|
|
setStoredSelectedAppId(legacy);
|
|
window.localStorage.removeItem(legacySelectedAppStorageKey);
|
|
return legacy;
|
|
}
|
|
|
|
return '';
|
|
}
|
|
|
|
export function setStoredSelectedAppId(appId: string) {
|
|
if (!appId) return;
|
|
window.localStorage.setItem(selectedAppStorageKey, appId);
|
|
}
|