shared-ritm 1.3.65 → 1.3.67

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.67",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist",
@@ -1,6 +1,9 @@
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
+ // eslint-disable-next-line
5
+ var isRefreshing = false
6
+
4
7
  interface Api_Auth_Refresh {
5
8
  accessToken: string
6
9
  }
@@ -11,8 +14,6 @@ export enum ApiServiceType {
11
14
 
12
15
  export default class ApiService {
13
16
  private axiosInstance: AxiosInstance
14
-
15
- private isRefreshing = false
16
17
  private refreshSubscribers: any[] = []
17
18
 
18
19
  constructor() {
@@ -54,16 +55,16 @@ export default class ApiService {
54
55
 
55
56
  originalRequest._retry = true
56
57
 
57
- alert(this.isRefreshing)
58
+ alert(isRefreshing)
58
59
 
59
- if (this.isRefreshing) {
60
+ if (isRefreshing) {
60
61
  alert(originalRequest.url)
61
62
  return new Promise(resolve => {
62
63
  this.subscribeTokenRefresh(() => resolve(this.axiosInstance(originalRequest)))
63
64
  })
64
65
  }
65
66
 
66
- this.isRefreshing = true
67
+ isRefreshing = true
67
68
 
68
69
  try {
69
70
  const response = await this.refresh()
@@ -76,7 +77,7 @@ export default class ApiService {
76
77
 
77
78
  this.setAccessToken(newToken)
78
79
  this.onRefreshed()
79
- this.isRefreshing = false
80
+ isRefreshing = false
80
81
  return this.axiosInstance(originalRequest)
81
82
  } catch (e) {
82
83
  this.logoutUser()
@@ -111,7 +112,7 @@ export default class ApiService {
111
112
  }
112
113
 
113
114
  public logoutUser(): any {
114
- this.isRefreshing = false
115
+ isRefreshing = false
115
116
  this.post<any, any>(`/v2/logout`, {})
116
117
  this.removeToken()
117
118
  window.location.href = '/sign-in'