diff options
Diffstat (limited to 'frontend/src/utilities/storage.ts')
-rw-r--r-- | frontend/src/utilities/storage.ts | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/frontend/src/utilities/storage.ts b/frontend/src/utilities/storage.ts new file mode 100644 index 000000000..1d7e39d97 --- /dev/null +++ b/frontend/src/utilities/storage.ts @@ -0,0 +1,17 @@ +import { useCallback } from "react"; +import { useLocalstorageState } from "rooks"; + +export const uiPageSizeKey = "storage-ui-pageSize"; + +export function useUpdateLocalStorage() { + return useCallback((newVals: LooseObject) => { + for (const key in newVals) { + const value = newVals[key]; + localStorage.setItem(key, value); + } + }, []); +} + +export function usePageSize() { + return useLocalstorageState(uiPageSizeKey, 50); +} |