@redzone/taunt-logins 0.0.17 → 0.0.18

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.
@@ -393,6 +393,10 @@ class TauntApi {
393
393
  }
394
394
  if (data?.accessToken) {
395
395
  this.accessToken = data.accessToken;
396
+ this.setAccessDetails?.({
397
+ accessToken: data.accessToken,
398
+ refreshToken: data.refreshToken ?? "_ignore_"
399
+ });
396
400
  }
397
401
  return data;
398
402
  }
@@ -536,7 +540,8 @@ class TauntApi {
536
540
  });
537
541
  return Promise.resolve();
538
542
  }
539
- constructor(endpoint){
543
+ constructor(endpoint, setAccessDetails){
544
+ this.setAccessDetails = setAccessDetails;
540
545
  this.claimrToken = null;
541
546
  this.onError = async (error)=>{
542
547
  const originalRequest = error.config;
@@ -619,7 +624,6 @@ class TauntApi {
619
624
  baseURL: endpoint,
620
625
  withCredentials: true
621
626
  });
622
- // Response interceptor for API calls
623
627
  this._axios.interceptors.response.use((response)=>response, (error)=>this.onError(error));
624
628
  }
625
629
  }
@@ -249,13 +249,14 @@ interface AxiosErrorResponse {
249
249
  }>;
250
250
  }
251
251
  declare class TauntApi {
252
+ private setAccessDetails?;
252
253
  private _axios;
254
+ constructor(endpoint: string, setAccessDetails?: ((props: TauntAccessDetails) => void) | undefined);
253
255
  get refreshToken(): string | null;
254
256
  set refreshToken(token: string | null);
255
257
  get accessToken(): string | null;
256
258
  set accessToken(token: string | null);
257
259
  private claimrToken;
258
- constructor(endpoint: string);
259
260
  onError: (error: AxiosErrorResponse) => Promise<AxiosResponse<any, any, {}>>;
260
261
  private _api;
261
262
  setLoginDetails: (props: TauntAccessDetails, checkGet?: boolean) => Promise<{
@@ -249,13 +249,14 @@ interface AxiosErrorResponse {
249
249
  }>;
250
250
  }
251
251
  declare class TauntApi {
252
+ private setAccessDetails?;
252
253
  private _axios;
254
+ constructor(endpoint: string, setAccessDetails?: ((props: TauntAccessDetails) => void) | undefined);
253
255
  get refreshToken(): string | null;
254
256
  set refreshToken(token: string | null);
255
257
  get accessToken(): string | null;
256
258
  set accessToken(token: string | null);
257
259
  private claimrToken;
258
- constructor(endpoint: string);
259
260
  onError: (error: AxiosErrorResponse) => Promise<AxiosResponse<any, any, {}>>;
260
261
  private _api;
261
262
  setLoginDetails: (props: TauntAccessDetails, checkGet?: boolean) => Promise<{
package/dist/es/index.js CHANGED
@@ -387,6 +387,10 @@ class TauntApi {
387
387
  }
388
388
  if (data?.accessToken) {
389
389
  this.accessToken = data.accessToken;
390
+ this.setAccessDetails?.({
391
+ accessToken: data.accessToken,
392
+ refreshToken: data.refreshToken ?? "_ignore_"
393
+ });
390
394
  }
391
395
  return data;
392
396
  }
@@ -530,7 +534,8 @@ class TauntApi {
530
534
  });
531
535
  return Promise.resolve();
532
536
  }
533
- constructor(endpoint){
537
+ constructor(endpoint, setAccessDetails){
538
+ this.setAccessDetails = setAccessDetails;
534
539
  this.claimrToken = null;
535
540
  this.onError = async (error)=>{
536
541
  const originalRequest = error.config;
@@ -613,7 +618,6 @@ class TauntApi {
613
618
  baseURL: endpoint,
614
619
  withCredentials: true
615
620
  });
616
- // Response interceptor for API calls
617
621
  this._axios.interceptors.response.use((response)=>response, (error)=>this.onError(error));
618
622
  }
619
623
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redzone/taunt-logins",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "files": [