curtain-web-api 1.0.10 → 1.0.11
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.
|
@@ -182,14 +182,19 @@ 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
|
-
this.user.
|
|
185
|
+
if (this.user.loginStatus) {
|
|
186
|
+
this.user.access_token = response.data.access;
|
|
187
|
+
this.user.refresh_token = response.data.refresh;
|
|
188
|
+
this.user.loginStatus = true;
|
|
189
|
+
this.user.updateDB().then();
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
186
192
|
this.user.access_token = response.data.access;
|
|
187
193
|
this.user.refresh_token = response.data.refresh;
|
|
188
194
|
this.user.loginStatus = true;
|
|
189
195
|
this.user.saveIntoDB().then(() => {
|
|
190
196
|
});
|
|
191
|
-
}
|
|
192
|
-
;
|
|
197
|
+
}
|
|
193
198
|
return response;
|
|
194
199
|
}).then((response) => {
|
|
195
200
|
return this.getUserInfo();
|
package/package.json
CHANGED
|
@@ -166,7 +166,12 @@ 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
|
-
this.user.
|
|
169
|
+
if (this.user.loginStatus) {
|
|
170
|
+
this.user.access_token = response.data.access;
|
|
171
|
+
this.user.refresh_token = response.data.refresh;
|
|
172
|
+
this.user.loginStatus = true;
|
|
173
|
+
this.user.updateDB().then();
|
|
174
|
+
} else {
|
|
170
175
|
this.user.access_token = response.data.access;
|
|
171
176
|
this.user.refresh_token = response.data.refresh;
|
|
172
177
|
this.user.loginStatus = true;
|
|
@@ -175,9 +180,9 @@ export class CurtainWebAPI {
|
|
|
175
180
|
|
|
176
181
|
}
|
|
177
182
|
)
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
|
|
181
186
|
return response;
|
|
182
187
|
}).then((response) => {
|
|
183
188
|
return this.getUserInfo();
|