shared-ritm 1.3.65 → 1.3.66

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.
@@ -4,7 +4,6 @@ export declare enum ApiServiceType {
4
4
  }
5
5
  export default class ApiService {
6
6
  private axiosInstance;
7
- private isRefreshing;
8
7
  private refreshSubscribers;
9
8
  constructor();
10
9
  private setAccessToken;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shared-ritm",
3
- "version": "1.3.65",
3
+ "version": "1.3.66",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist",
@@ -1,6 +1,8 @@
1
1
  import axios, { AxiosError, AxiosInstance, AxiosRequestConfig, AxiosResponse, InternalAxiosRequestConfig } from 'axios'
2
2
  import { Api_Auth_Login } from '@/api/types/Api_Auth'
3
3
 
4
+ let isRefreshing = false
5
+
4
6
  interface Api_Auth_Refresh {
5
7
  accessToken: string
6
8
  }
@@ -11,8 +13,6 @@ export enum ApiServiceType {
11
13
 
12
14
  export default class ApiService {
13
15
  private axiosInstance: AxiosInstance
14
-
15
- private isRefreshing = false
16
16
  private refreshSubscribers: any[] = []
17
17
 
18
18
  constructor() {
@@ -54,16 +54,16 @@ export default class ApiService {
54
54
 
55
55
  originalRequest._retry = true
56
56
 
57
- alert(this.isRefreshing)
57
+ alert(isRefreshing)
58
58
 
59
- if (this.isRefreshing) {
59
+ if (isRefreshing) {
60
60
  alert(originalRequest.url)
61
61
  return new Promise(resolve => {
62
62
  this.subscribeTokenRefresh(() => resolve(this.axiosInstance(originalRequest)))
63
63
  })
64
64
  }
65
65
 
66
- this.isRefreshing = true
66
+ isRefreshing = true
67
67
 
68
68
  try {
69
69
  const response = await this.refresh()
@@ -76,7 +76,7 @@ export default class ApiService {
76
76
 
77
77
  this.setAccessToken(newToken)
78
78
  this.onRefreshed()
79
- this.isRefreshing = false
79
+ isRefreshing = false
80
80
  return this.axiosInstance(originalRequest)
81
81
  } catch (e) {
82
82
  this.logoutUser()
@@ -111,7 +111,7 @@ export default class ApiService {
111
111
  }
112
112
 
113
113
  public logoutUser(): any {
114
- this.isRefreshing = false
114
+ isRefreshing = false
115
115
  this.post<any, any>(`/v2/logout`, {})
116
116
  this.removeToken()
117
117
  window.location.href = '/sign-in'