@eluvio/elv-client-js 3.2.27 → 3.2.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/walletClient/index.js +10 -3
package/package.json
CHANGED
|
@@ -9,6 +9,13 @@ const Ethers = require("ethers");
|
|
|
9
9
|
const inBrowser = typeof window !== "undefined";
|
|
10
10
|
const embedded = inBrowser && window.top !== window.self;
|
|
11
11
|
|
|
12
|
+
let localStorageAvailable = false;
|
|
13
|
+
try {
|
|
14
|
+
typeof localStorage !== "undefined" && localStorage.getItem("test");
|
|
15
|
+
localStorageAvailable = true;
|
|
16
|
+
// eslint-disable-next-line no-empty
|
|
17
|
+
} catch(error) {}
|
|
18
|
+
|
|
12
19
|
/**
|
|
13
20
|
* Use the <a href="#.Initialize">Initialize</a> method to initialize a new client.
|
|
14
21
|
*
|
|
@@ -129,7 +136,7 @@ class ElvWalletClient {
|
|
|
129
136
|
url.searchParams.delete("elvToken");
|
|
130
137
|
|
|
131
138
|
window.history.replaceState("", "", url);
|
|
132
|
-
} else if(storeAuthToken &&
|
|
139
|
+
} else if(storeAuthToken && localStorageAvailable) {
|
|
133
140
|
try {
|
|
134
141
|
// Load saved auth token
|
|
135
142
|
let savedToken = localStorage.getItem(`__elv-token-${network}`);
|
|
@@ -342,7 +349,7 @@ class ElvWalletClient {
|
|
|
342
349
|
this.cachedMarketplaces = {};
|
|
343
350
|
|
|
344
351
|
// Delete saved auth token
|
|
345
|
-
if(
|
|
352
|
+
if(localStorageAvailable) {
|
|
346
353
|
try {
|
|
347
354
|
localStorage.removeItem(`__elv-token-${this.network}`);
|
|
348
355
|
// eslint-disable-next-line no-empty
|
|
@@ -532,7 +539,7 @@ class ElvWalletClient {
|
|
|
532
539
|
|
|
533
540
|
const token = this.ClientAuthToken();
|
|
534
541
|
|
|
535
|
-
if(this.storeAuthToken &&
|
|
542
|
+
if(this.storeAuthToken && localStorageAvailable) {
|
|
536
543
|
try {
|
|
537
544
|
localStorage.setItem(`__elv-token-${this.network}`, token);
|
|
538
545
|
// eslint-disable-next-line no-empty
|