curtain-web-api 1.0.32 → 1.0.34
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.
|
@@ -184,10 +184,13 @@ class CurtainWebAPI {
|
|
|
184
184
|
let headers = new axios_1.AxiosHeaders();
|
|
185
185
|
headers["Accept"] = "application/json";
|
|
186
186
|
headers["Content-Type"] = "application/json";
|
|
187
|
-
return this.
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
return this.
|
|
187
|
+
return this.user.loadFromDB().then((response) => {
|
|
188
|
+
console.log(this.user);
|
|
189
|
+
return this.axiosInstance.post(this.orcidLoginURL, JSON.stringify({ "auth_token": authorizationCode, "redirect_uri": redirectURI }), { headers: headers, responseType: "json" }).then((response) => {
|
|
190
|
+
return this.user.saveIntoDB(response.data.access, response.data.refresh).then((response) => {
|
|
191
|
+
console.log(this.user);
|
|
192
|
+
return this.getUserInfo();
|
|
193
|
+
});
|
|
191
194
|
});
|
|
192
195
|
});
|
|
193
196
|
}
|
|
@@ -258,7 +261,7 @@ class CurtainWebAPI {
|
|
|
258
261
|
let headers = new axios_1.AxiosHeaders();
|
|
259
262
|
headers["Accept"] = "application/json";
|
|
260
263
|
headers["Content-Type"] = "application/json";
|
|
261
|
-
return this.axiosInstance.post(this.baseURL + "curtain/" + linkId + "/generate_token", { lifetime: lifetime }, { headers: headers, responseType: "json" }).then((response) => {
|
|
264
|
+
return this.axiosInstance.post(this.baseURL + "curtain/" + linkId + "/generate_token/", { lifetime: lifetime }, { headers: headers, responseType: "json" }).then((response) => {
|
|
262
265
|
return response;
|
|
263
266
|
});
|
|
264
267
|
}
|
package/package.json
CHANGED
|
@@ -126,6 +126,7 @@ export class CurtainWebAPI {
|
|
|
126
126
|
headers["Accept"] = "application/json";
|
|
127
127
|
headers["Content-Type"] = "application/json";
|
|
128
128
|
console.log(this.user)
|
|
129
|
+
|
|
129
130
|
return this.axiosInstance.post(this.userInfoURL, {}, {headers: headers, responseType: "json"}).then((response) => {
|
|
130
131
|
this.user.canDelete = response.data.can_delete;
|
|
131
132
|
this.user.id = response.data.id;
|
|
@@ -167,12 +168,17 @@ export class CurtainWebAPI {
|
|
|
167
168
|
let headers = new AxiosHeaders();
|
|
168
169
|
headers["Accept"] = "application/json";
|
|
169
170
|
headers["Content-Type"] = "application/json";
|
|
170
|
-
return this.
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
return this.
|
|
174
|
-
|
|
175
|
-
|
|
171
|
+
return this.user.loadFromDB().then(
|
|
172
|
+
(response) => {
|
|
173
|
+
console.log(this.user)
|
|
174
|
+
return this.axiosInstance.post(this.orcidLoginURL, JSON.stringify({"auth_token": authorizationCode, "redirect_uri": redirectURI}), {headers: headers, responseType:"json"}).then((response) => {
|
|
175
|
+
return this.user.saveIntoDB(response.data.access, response.data.refresh).then((response) => {
|
|
176
|
+
console.log(this.user)
|
|
177
|
+
return this.getUserInfo()
|
|
178
|
+
})
|
|
179
|
+
})
|
|
180
|
+
}
|
|
181
|
+
)
|
|
176
182
|
}
|
|
177
183
|
|
|
178
184
|
checkIfRefreshTokenExpired() {
|
|
@@ -247,7 +253,7 @@ export class CurtainWebAPI {
|
|
|
247
253
|
let headers = new AxiosHeaders();
|
|
248
254
|
headers["Accept"] = "application/json";
|
|
249
255
|
headers["Content-Type"] = "application/json";
|
|
250
|
-
return this.axiosInstance.post(this.baseURL + "curtain/" + linkId + "/generate_token", {lifetime: lifetime}, {headers: headers, responseType:"json"}).then((response) => {
|
|
256
|
+
return this.axiosInstance.post(this.baseURL + "curtain/" + linkId + "/generate_token/", {lifetime: lifetime}, {headers: headers, responseType:"json"}).then((response) => {
|
|
251
257
|
return response;
|
|
252
258
|
});
|
|
253
259
|
}
|