mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-06 00:07:44 +01:00
25 lines
550 B
TypeScript
25 lines
550 B
TypeScript
import { createLocalStorage } from 'utils/createLocalStorage';
|
|
|
|
interface IGlobalStore {
|
|
favorites?: boolean;
|
|
hiddenEnvironments?: Array<string>;
|
|
}
|
|
|
|
export const useGlobalLocalStorage = () => {
|
|
const { value, setValue } = createLocalStorage<IGlobalStore>(
|
|
'global:v1',
|
|
{},
|
|
);
|
|
|
|
// fix incorrect values introduced by a bug
|
|
const parsedValue = {
|
|
...value,
|
|
hiddenEnvironments: Array.from(value.hiddenEnvironments || []),
|
|
};
|
|
|
|
return {
|
|
value: parsedValue,
|
|
setValue,
|
|
};
|
|
};
|