-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
75 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
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}`); | ||
} | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters