shared-ritm 1.3.52 → 1.3.54
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.
|
@@ -64,6 +64,15 @@ export type Api_Auth_User = {
|
|
|
64
64
|
roles: Api_Auth_User_Role[];
|
|
65
65
|
security_warnings: any[];
|
|
66
66
|
teams: Api_Auth_User_Team[];
|
|
67
|
+
avatar: null;
|
|
68
|
+
change_password: null;
|
|
69
|
+
created_at: string;
|
|
70
|
+
deleted_at: null;
|
|
71
|
+
face_recognition_id: null;
|
|
72
|
+
password_change_available_at: string;
|
|
73
|
+
password_change_due_at: string;
|
|
74
|
+
password_last_changed_at: string;
|
|
75
|
+
updated_at: string;
|
|
67
76
|
};
|
|
68
77
|
export type Api_Auth_Login = {
|
|
69
78
|
token: string;
|
package/package.json
CHANGED
|
@@ -12,14 +12,10 @@ export enum ApiServiceType {
|
|
|
12
12
|
export default class ApiService {
|
|
13
13
|
private axiosInstance: AxiosInstance
|
|
14
14
|
|
|
15
|
-
private access_token: string | null = null
|
|
16
|
-
|
|
17
15
|
private isRefreshing = false
|
|
18
16
|
private refreshSubscribers: any[] = []
|
|
19
17
|
|
|
20
18
|
constructor() {
|
|
21
|
-
this.access_token = this.getAccessToken()
|
|
22
|
-
|
|
23
19
|
this.axiosInstance = axios.create({
|
|
24
20
|
baseURL: process.env.VUE_APP_BACKEND,
|
|
25
21
|
headers: {
|
|
@@ -31,9 +27,7 @@ export default class ApiService {
|
|
|
31
27
|
|
|
32
28
|
this.axiosInstance.interceptors.request.use(
|
|
33
29
|
(config: InternalAxiosRequestConfig) => {
|
|
34
|
-
|
|
35
|
-
config.headers.Authorization = `Bearer ${this.access_token}`
|
|
36
|
-
}
|
|
30
|
+
config.headers.Authorization = `Bearer ${this.getAccessToken()}`
|
|
37
31
|
return config
|
|
38
32
|
},
|
|
39
33
|
(error: AxiosError) => {
|
|
@@ -48,7 +42,7 @@ export default class ApiService {
|
|
|
48
42
|
async error => {
|
|
49
43
|
const originalRequest = error.config
|
|
50
44
|
|
|
51
|
-
if (error.response?.status !== 401) {
|
|
45
|
+
if (error.response?.status !== 401 || originalRequest.url === '/v2/auth/refresh') {
|
|
52
46
|
return Promise.reject(error)
|
|
53
47
|
}
|
|
54
48
|
|
|
@@ -70,21 +64,16 @@ export default class ApiService {
|
|
|
70
64
|
const response = await this.refresh()
|
|
71
65
|
|
|
72
66
|
const newToken = response.accessToken
|
|
73
|
-
console.log(newToken)
|
|
74
67
|
if (!newToken) {
|
|
75
68
|
this.logoutUser()
|
|
76
69
|
return Promise.reject(error)
|
|
77
70
|
}
|
|
78
71
|
|
|
79
72
|
this.setAccessToken(newToken)
|
|
80
|
-
|
|
81
73
|
this.onRefreshed(newToken)
|
|
82
74
|
this.isRefreshing = false
|
|
83
|
-
|
|
84
|
-
originalRequest.headers['Authorization'] = `Bearer ${newToken}`
|
|
85
75
|
return this.axiosInstance(originalRequest)
|
|
86
76
|
} catch (e) {
|
|
87
|
-
this.isRefreshing = false
|
|
88
77
|
this.logoutUser()
|
|
89
78
|
return Promise.reject(e)
|
|
90
79
|
}
|
|
@@ -117,6 +106,7 @@ export default class ApiService {
|
|
|
117
106
|
}
|
|
118
107
|
|
|
119
108
|
public logoutUser(): any {
|
|
109
|
+
this.isRefreshing = false
|
|
120
110
|
this.post<any, any>(`/v2/logout`, {})
|
|
121
111
|
this.removeToken()
|
|
122
112
|
window.location.href = '/sign-in'
|
|
@@ -72,6 +72,15 @@ export type Api_Auth_User = {
|
|
|
72
72
|
roles: Api_Auth_User_Role[]
|
|
73
73
|
security_warnings: any[]
|
|
74
74
|
teams: Api_Auth_User_Team[]
|
|
75
|
+
avatar: null
|
|
76
|
+
change_password: null
|
|
77
|
+
created_at: string
|
|
78
|
+
deleted_at: null
|
|
79
|
+
face_recognition_id: null
|
|
80
|
+
password_change_available_at: string
|
|
81
|
+
password_change_due_at: string
|
|
82
|
+
password_last_changed_at: string
|
|
83
|
+
updated_at: string
|
|
75
84
|
}
|
|
76
85
|
|
|
77
86
|
export type Api_Auth_Login = {
|