curtain-web-api 1.0.6 → 1.0.8
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/.idea/curtain-web-api.iml +2 -0
- package/.idea/vcs.xml +6 -0
- package/README.md +1 -1
- package/build/classes/curtain-api.d.ts +1 -1
- package/build/classes/curtain-api.js +28 -2
- package/package.json +1 -1
- package/src/classes/curtain-api.ts +29 -2
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
|
7
7
|
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
|
8
8
|
<excludeFolder url="file://$MODULE_DIR$/node_modules" />
|
|
9
|
+
<excludeFolder url="file://$MODULE_DIR$/build" />
|
|
10
|
+
<excludeFolder url="file://$MODULE_DIR$/curtainuser" />
|
|
9
11
|
</content>
|
|
10
12
|
<orderEntry type="inheritedJdk" />
|
|
11
13
|
<orderEntry type="sourceFolder" forTests="false" />
|
package/.idea/vcs.xml
ADDED
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@ export declare class CurtainWebAPI {
|
|
|
32
32
|
getSiteProperties(): Promise<import("axios").AxiosResponse<any, any>>;
|
|
33
33
|
saveDataFilterList(name: string, data: string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
34
34
|
getDataFilterListByID(id: number): Promise<import("axios").AxiosResponse<any, any>>;
|
|
35
|
-
getDataFilterList(categoryName?: string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
35
|
+
getDataFilterList(categoryName?: string, searchTerm?: string, limit?: number): Promise<import("axios").AxiosResponse<any, any>>;
|
|
36
36
|
deleteDataFilterList(id: number): Promise<import("axios").AxiosResponse<any, any>>;
|
|
37
37
|
downloadStats(): Promise<import("axios").AxiosResponse<any, any>>;
|
|
38
38
|
}
|
|
@@ -67,6 +67,27 @@ class CurtainWebAPI {
|
|
|
67
67
|
this.userInfoURL = baseURL + "user/";
|
|
68
68
|
this.axiosInstance.interceptors.request.use((config) => {
|
|
69
69
|
if (config.url) {
|
|
70
|
+
/*if (!this.checkIfRefreshTokenExpired() && this.user.loginStatus) {
|
|
71
|
+
if (config.url !== this.refereshURL &&
|
|
72
|
+
config.url !== this.loginURL &&
|
|
73
|
+
config.url !== this.orcidLoginURL) {
|
|
74
|
+
if (!this.checkIfRefreshTokenExpired() && this.user.loginStatus) {
|
|
75
|
+
console.log("refreshing token")
|
|
76
|
+
if (!this.isRefreshing) {
|
|
77
|
+
return this.refresh().then((response) => {
|
|
78
|
+
this.isRefreshing = false;
|
|
79
|
+
return this.axiosInstance.request(config);
|
|
80
|
+
}).catch((error) => {
|
|
81
|
+
this.isRefreshing = false;
|
|
82
|
+
this.user = new User();
|
|
83
|
+
return error;
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
} else {
|
|
89
|
+
this.user = new User();
|
|
90
|
+
}*/
|
|
70
91
|
if (
|
|
71
92
|
//config.url === this.refereshURL ||
|
|
72
93
|
config.url === this.logoutURL ||
|
|
@@ -116,6 +137,7 @@ class CurtainWebAPI {
|
|
|
116
137
|
this.user.access_token = response.data.access;
|
|
117
138
|
this.user.refresh_token = response.data.refresh;
|
|
118
139
|
this.user.loginStatus = true;
|
|
140
|
+
this.user.saveIntoDB().then();
|
|
119
141
|
return this.getUserInfo();
|
|
120
142
|
});
|
|
121
143
|
}
|
|
@@ -163,6 +185,7 @@ class CurtainWebAPI {
|
|
|
163
185
|
this.user.access_token = response.data.access;
|
|
164
186
|
this.user.refresh_token = response.data.refresh;
|
|
165
187
|
this.user.loginStatus = true;
|
|
188
|
+
this.user.saveIntoDB().then();
|
|
166
189
|
return response;
|
|
167
190
|
}).then((response) => {
|
|
168
191
|
return this.getUserInfo();
|
|
@@ -309,12 +332,15 @@ class CurtainWebAPI {
|
|
|
309
332
|
return response;
|
|
310
333
|
});
|
|
311
334
|
}
|
|
312
|
-
getDataFilterList(categoryName = "") {
|
|
335
|
+
getDataFilterList(categoryName = "", searchTerm = "", limit = 99999999) {
|
|
313
336
|
let params = new URLSearchParams();
|
|
314
337
|
if (categoryName != "") {
|
|
315
338
|
params.append("name", categoryName);
|
|
316
339
|
}
|
|
317
|
-
|
|
340
|
+
if (searchTerm != "" && searchTerm != undefined) {
|
|
341
|
+
params.append("data", searchTerm);
|
|
342
|
+
}
|
|
343
|
+
params.append("limit", limit.toString());
|
|
318
344
|
return this.axiosInstance.get(this.baseURL + "data_filter_list/", { responseType: "json", params });
|
|
319
345
|
}
|
|
320
346
|
deleteDataFilterList(id) {
|
package/package.json
CHANGED
|
@@ -43,6 +43,27 @@ export class CurtainWebAPI {
|
|
|
43
43
|
this.userInfoURL = baseURL + "user/";
|
|
44
44
|
this.axiosInstance.interceptors.request.use((config) => {
|
|
45
45
|
if (config.url) {
|
|
46
|
+
/*if (!this.checkIfRefreshTokenExpired() && this.user.loginStatus) {
|
|
47
|
+
if (config.url !== this.refereshURL &&
|
|
48
|
+
config.url !== this.loginURL &&
|
|
49
|
+
config.url !== this.orcidLoginURL) {
|
|
50
|
+
if (!this.checkIfRefreshTokenExpired() && this.user.loginStatus) {
|
|
51
|
+
console.log("refreshing token")
|
|
52
|
+
if (!this.isRefreshing) {
|
|
53
|
+
return this.refresh().then((response) => {
|
|
54
|
+
this.isRefreshing = false;
|
|
55
|
+
return this.axiosInstance.request(config);
|
|
56
|
+
}).catch((error) => {
|
|
57
|
+
this.isRefreshing = false;
|
|
58
|
+
this.user = new User();
|
|
59
|
+
return error;
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
} else {
|
|
65
|
+
this.user = new User();
|
|
66
|
+
}*/
|
|
46
67
|
if (
|
|
47
68
|
//config.url === this.refereshURL ||
|
|
48
69
|
config.url === this.logoutURL ||
|
|
@@ -94,6 +115,7 @@ export class CurtainWebAPI {
|
|
|
94
115
|
this.user.access_token = response.data.access;
|
|
95
116
|
this.user.refresh_token = response.data.refresh;
|
|
96
117
|
this.user.loginStatus = true;
|
|
118
|
+
this.user.saveIntoDB().then();
|
|
97
119
|
return this.getUserInfo();
|
|
98
120
|
});
|
|
99
121
|
}
|
|
@@ -147,6 +169,7 @@ export class CurtainWebAPI {
|
|
|
147
169
|
this.user.access_token = response.data.access;
|
|
148
170
|
this.user.refresh_token = response.data.refresh;
|
|
149
171
|
this.user.loginStatus = true;
|
|
172
|
+
this.user.saveIntoDB().then();
|
|
150
173
|
return response;
|
|
151
174
|
}).then((response) => {
|
|
152
175
|
return this.getUserInfo();
|
|
@@ -313,12 +336,16 @@ export class CurtainWebAPI {
|
|
|
313
336
|
});
|
|
314
337
|
}
|
|
315
338
|
|
|
316
|
-
getDataFilterList(categoryName: string = "") {
|
|
339
|
+
getDataFilterList(categoryName: string = "", searchTerm: string = "", limit: number = 99999999) {
|
|
317
340
|
let params = new URLSearchParams();
|
|
318
341
|
if (categoryName != "") {
|
|
319
342
|
params.append("name", categoryName)
|
|
320
343
|
}
|
|
321
|
-
|
|
344
|
+
if (searchTerm != "" && searchTerm != undefined) {
|
|
345
|
+
params.append("data", searchTerm)
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
params.append("limit", limit.toString())
|
|
322
349
|
return this.axiosInstance.get(this.baseURL + "data_filter_list/", {responseType:"json", params})
|
|
323
350
|
}
|
|
324
351
|
|