@redzone/taunt-logins 0.0.15 → 0.0.16
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/dist/cjs/index.cjs +11 -2
- package/dist/cjs/index.d.cts +2 -1
- package/dist/es/index.d.ts +2 -1
- package/dist/es/index.js +11 -2
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -347,7 +347,18 @@ function ErrorFromResponse(response) {
|
|
|
347
347
|
}
|
|
348
348
|
}
|
|
349
349
|
|
|
350
|
+
const REFRESH_KEY = "taunt_refresh_token";
|
|
350
351
|
class TauntApi {
|
|
352
|
+
get refreshToken() {
|
|
353
|
+
return localStorage.getItem(REFRESH_KEY);
|
|
354
|
+
}
|
|
355
|
+
set refreshToken(token) {
|
|
356
|
+
if (token) {
|
|
357
|
+
localStorage.setItem(REFRESH_KEY, token);
|
|
358
|
+
} else {
|
|
359
|
+
localStorage.removeItem(REFRESH_KEY);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
351
362
|
async _api(method, url, body, headers = {}) {
|
|
352
363
|
headers = {
|
|
353
364
|
"Content-Type": "application/json",
|
|
@@ -389,7 +400,6 @@ class TauntApi {
|
|
|
389
400
|
try {
|
|
390
401
|
signature = await provider.personalSign(message, walletAddress);
|
|
391
402
|
} catch (err) {
|
|
392
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
393
403
|
throw new Error(`User denied message signature, ${err}`);
|
|
394
404
|
}
|
|
395
405
|
if (!signature) {
|
|
@@ -509,7 +519,6 @@ class TauntApi {
|
|
|
509
519
|
return Promise.resolve();
|
|
510
520
|
}
|
|
511
521
|
constructor(endpoint){
|
|
512
|
-
this.refreshToken = null;
|
|
513
522
|
this.claimrToken = null;
|
|
514
523
|
this.onError = async (error)=>{
|
|
515
524
|
const originalRequest = error.config;
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -250,7 +250,8 @@ interface AxiosErrorResponse {
|
|
|
250
250
|
}
|
|
251
251
|
declare class TauntApi {
|
|
252
252
|
private _axios;
|
|
253
|
-
|
|
253
|
+
get refreshToken(): string | null;
|
|
254
|
+
set refreshToken(token: string | null);
|
|
254
255
|
private claimrToken;
|
|
255
256
|
constructor(endpoint: string);
|
|
256
257
|
onError: (error: AxiosErrorResponse) => Promise<AxiosResponse<any, any, {}>>;
|
package/dist/es/index.d.ts
CHANGED
|
@@ -250,7 +250,8 @@ interface AxiosErrorResponse {
|
|
|
250
250
|
}
|
|
251
251
|
declare class TauntApi {
|
|
252
252
|
private _axios;
|
|
253
|
-
|
|
253
|
+
get refreshToken(): string | null;
|
|
254
|
+
set refreshToken(token: string | null);
|
|
254
255
|
private claimrToken;
|
|
255
256
|
constructor(endpoint: string);
|
|
256
257
|
onError: (error: AxiosErrorResponse) => Promise<AxiosResponse<any, any, {}>>;
|
package/dist/es/index.js
CHANGED
|
@@ -341,7 +341,18 @@ function ErrorFromResponse(response) {
|
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
343
|
|
|
344
|
+
const REFRESH_KEY = "taunt_refresh_token";
|
|
344
345
|
class TauntApi {
|
|
346
|
+
get refreshToken() {
|
|
347
|
+
return localStorage.getItem(REFRESH_KEY);
|
|
348
|
+
}
|
|
349
|
+
set refreshToken(token) {
|
|
350
|
+
if (token) {
|
|
351
|
+
localStorage.setItem(REFRESH_KEY, token);
|
|
352
|
+
} else {
|
|
353
|
+
localStorage.removeItem(REFRESH_KEY);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
345
356
|
async _api(method, url, body, headers = {}) {
|
|
346
357
|
headers = {
|
|
347
358
|
"Content-Type": "application/json",
|
|
@@ -383,7 +394,6 @@ class TauntApi {
|
|
|
383
394
|
try {
|
|
384
395
|
signature = await provider.personalSign(message, walletAddress);
|
|
385
396
|
} catch (err) {
|
|
386
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
387
397
|
throw new Error(`User denied message signature, ${err}`);
|
|
388
398
|
}
|
|
389
399
|
if (!signature) {
|
|
@@ -503,7 +513,6 @@ class TauntApi {
|
|
|
503
513
|
return Promise.resolve();
|
|
504
514
|
}
|
|
505
515
|
constructor(endpoint){
|
|
506
|
-
this.refreshToken = null;
|
|
507
516
|
this.claimrToken = null;
|
|
508
517
|
this.onError = async (error)=>{
|
|
509
518
|
const originalRequest = error.config;
|