aboutsummaryrefslogtreecommitdiffstats
path: root/ui/lib
diff options
context:
space:
mode:
authorDan Miller <danjm.com@gmail.com>2018-10-24 14:31:45 +0800
committerDan Miller <danjm.com@gmail.com>2018-12-04 11:36:22 +0800
commit79de7a45ae8da7a9578ce394594e700886a640eb (patch)
tree2305ac70fc7bd7eee28a792b834186b302351a3e /ui/lib
parente3f015c88f30fb4243ebbb3d2f109be8f3d68196 (diff)
downloadtangerine-wallet-browser-79de7a45ae8da7a9578ce394594e700886a640eb.tar.gz
tangerine-wallet-browser-79de7a45ae8da7a9578ce394594e700886a640eb.tar.zst
tangerine-wallet-browser-79de7a45ae8da7a9578ce394594e700886a640eb.zip
Connect gas price chart to gas station api.
Diffstat (limited to 'ui/lib')
-rw-r--r--ui/lib/local-storage-helpers.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/ui/lib/local-storage-helpers.js b/ui/lib/local-storage-helpers.js
new file mode 100644
index 000000000..287586c49
--- /dev/null
+++ b/ui/lib/local-storage-helpers.js
@@ -0,0 +1,20 @@
+export function loadLocalStorageData (itemKey) {
+ try {
+ const serializedData = localStorage.getItem(itemKey)
+ if (serializedData === null) {
+ return undefined
+ }
+ return JSON.parse(serializedData)
+ } catch (err) {
+ return undefined
+ }
+}
+
+export function saveLocalStorageData (data, itemKey) {
+ try {
+ const serializedData = JSON.stringify(data)
+ localStorage.setItem(itemKey, serializedData)
+ } catch (err) {
+ console.warn(err)
+ }
+}