Updates #6206
Squashed commit of the following:
commit 03089136a749fbda7da9be1af5997a24738eabb6
Merge: 7078c449c 3ce3c41b5
Author: Ildar Kamalov <ik@adguard.com>
Date: Wed Oct 11 15:25:11 2023 +0300
Merge branch 'master' into ADG-7558
commit 7078c449cb02039b47bdd085de12145b6982ea2c
Author: Ildar Kamalov <ik@adguard.com>
Date: Mon Oct 9 19:47:58 2023 +0300
fix default page size
commit 64569487a916797bbb42246eb935f1388626590e
Author: Ildar Kamalov <ik@adguard.com>
Date: Mon Oct 9 19:47:22 2023 +0300
remove unused
commit 17614fa76b5aab617b807e226f743b9fd461c247
Author: Ildar Kamalov <ik@adguard.com>
Date: Mon Oct 9 19:30:22 2023 +0300
ADG-7473 get table page size from local storage
45 lines
1.2 KiB
JavaScript
45 lines
1.2 KiB
JavaScript
export const LOCAL_STORAGE_KEYS = {
|
|
THEME: 'account_theme',
|
|
BLOCKLIST_PAGE_SIZE: 'blocklist_page_size',
|
|
ALLOWLIST_PAGE_SIZE: 'allowlist_page_size',
|
|
CLIENTS_PAGE_SIZE: 'clients_page_size',
|
|
REWRITES_PAGE_SIZE: 'rewrites_page_size',
|
|
AUTO_CLIENTS_PAGE_SIZE: 'auto_clients_page_size',
|
|
};
|
|
|
|
export const LocalStorageHelper = {
|
|
setItem(key, value) {
|
|
try {
|
|
localStorage.setItem(key, JSON.stringify(value));
|
|
} catch (error) {
|
|
console.error(`Error setting ${key} in local storage: ${error.message}`);
|
|
}
|
|
},
|
|
|
|
getItem(key) {
|
|
try {
|
|
const item = localStorage.getItem(key);
|
|
return item ? JSON.parse(item) : null;
|
|
} catch (error) {
|
|
console.error(`Error getting ${key} from local storage: ${error.message}`);
|
|
return null;
|
|
}
|
|
},
|
|
|
|
removeItem(key) {
|
|
try {
|
|
localStorage.removeItem(key);
|
|
} catch (error) {
|
|
console.error(`Error removing ${key} from local storage: ${error.message}`);
|
|
}
|
|
},
|
|
|
|
clear() {
|
|
try {
|
|
localStorage.clear();
|
|
} catch (error) {
|
|
console.error(`Error clearing local storage: ${error.message}`);
|
|
}
|
|
},
|
|
};
|