The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/apps/meteor/client/lib/utils/getConfig.ts

15 lines
425 B

const readLocalStorage = (key: string): string | null => {
try {
return window.localStorage.getItem(key);
} catch {
return null;
}
};
export const getConfig = <T>(key: string, defaultValue?: T): string | null | T => {
const searchParams = new URLSearchParams(window.location.search);
const storedItem = searchParams.get(key) || readLocalStorage(`rc-config-${key}`);
return storedItem ?? defaultValue ?? null;
};