curtain-web-api 1.0.7 → 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.
|
@@ -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 ||
|
|
@@ -311,12 +332,15 @@ class CurtainWebAPI {
|
|
|
311
332
|
return response;
|
|
312
333
|
});
|
|
313
334
|
}
|
|
314
|
-
getDataFilterList(categoryName = "") {
|
|
335
|
+
getDataFilterList(categoryName = "", searchTerm = "", limit = 99999999) {
|
|
315
336
|
let params = new URLSearchParams();
|
|
316
337
|
if (categoryName != "") {
|
|
317
338
|
params.append("name", categoryName);
|
|
318
339
|
}
|
|
319
|
-
|
|
340
|
+
if (searchTerm != "" && searchTerm != undefined) {
|
|
341
|
+
params.append("data", searchTerm);
|
|
342
|
+
}
|
|
343
|
+
params.append("limit", limit.toString());
|
|
320
344
|
return this.axiosInstance.get(this.baseURL + "data_filter_list/", { responseType: "json", params });
|
|
321
345
|
}
|
|
322
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 ||
|
|
@@ -315,12 +336,16 @@ export class CurtainWebAPI {
|
|
|
315
336
|
});
|
|
316
337
|
}
|
|
317
338
|
|
|
318
|
-
getDataFilterList(categoryName: string = "") {
|
|
339
|
+
getDataFilterList(categoryName: string = "", searchTerm: string = "", limit: number = 99999999) {
|
|
319
340
|
let params = new URLSearchParams();
|
|
320
341
|
if (categoryName != "") {
|
|
321
342
|
params.append("name", categoryName)
|
|
322
343
|
}
|
|
323
|
-
|
|
344
|
+
if (searchTerm != "" && searchTerm != undefined) {
|
|
345
|
+
params.append("data", searchTerm)
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
params.append("limit", limit.toString())
|
|
324
349
|
return this.axiosInstance.get(this.baseURL + "data_filter_list/", {responseType:"json", params})
|
|
325
350
|
}
|
|
326
351
|
|