curtain-web-api 1.0.11 → 1.0.12
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/build/classes/curtain-api.js +15 -13
- package/package.json +1 -1
- package/src/classes/curtain-api.ts +18 -13
|
@@ -182,19 +182,21 @@ class CurtainWebAPI {
|
|
|
182
182
|
headers["Accept"] = "application/json";
|
|
183
183
|
headers["Content-Type"] = "application/json";
|
|
184
184
|
return this.axiosInstance.post(this.orcidLoginURL, JSON.stringify({ "auth_token": authorizationCode, "redirect_uri": redirectURI }), { headers: headers, responseType: "json" }).then((response) => {
|
|
185
|
-
|
|
186
|
-
this.user.
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
185
|
+
this.user.clearDB().then(() => {
|
|
186
|
+
if (this.user.loginStatus) {
|
|
187
|
+
this.user.access_token = response.data.access;
|
|
188
|
+
this.user.refresh_token = response.data.refresh;
|
|
189
|
+
this.user.loginStatus = true;
|
|
190
|
+
this.user.updateDB().then();
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
this.user.access_token = response.data.access;
|
|
194
|
+
this.user.refresh_token = response.data.refresh;
|
|
195
|
+
this.user.loginStatus = true;
|
|
196
|
+
this.user.saveIntoDB().then(() => {
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
});
|
|
198
200
|
return response;
|
|
199
201
|
}).then((response) => {
|
|
200
202
|
return this.getUserInfo();
|
package/package.json
CHANGED
|
@@ -166,21 +166,26 @@ export class CurtainWebAPI {
|
|
|
166
166
|
headers["Accept"] = "application/json";
|
|
167
167
|
headers["Content-Type"] = "application/json";
|
|
168
168
|
return this.axiosInstance.post(this.orcidLoginURL, JSON.stringify({"auth_token": authorizationCode, "redirect_uri": redirectURI}), {headers: headers, responseType:"json"}).then((response) => {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
169
|
+
this.user.clearDB().then(
|
|
170
|
+
() => {
|
|
171
|
+
if (this.user.loginStatus) {
|
|
172
|
+
this.user.access_token = response.data.access;
|
|
173
|
+
this.user.refresh_token = response.data.refresh;
|
|
174
|
+
this.user.loginStatus = true;
|
|
175
|
+
this.user.updateDB().then();
|
|
176
|
+
} else {
|
|
177
|
+
this.user.access_token = response.data.access;
|
|
178
|
+
this.user.refresh_token = response.data.refresh;
|
|
179
|
+
this.user.loginStatus = true;
|
|
180
|
+
this.user.saveIntoDB().then(
|
|
181
|
+
() => {
|
|
180
182
|
|
|
183
|
+
}
|
|
184
|
+
)
|
|
181
185
|
}
|
|
182
|
-
|
|
183
|
-
|
|
186
|
+
}
|
|
187
|
+
);
|
|
188
|
+
|
|
184
189
|
|
|
185
190
|
|
|
186
191
|
return response;
|