fix onedrive auth process

This commit is contained in:
fyears 2022-01-01 00:52:07 +08:00
parent d53569fe71
commit 02e5f9b5a0

View File

@ -105,6 +105,16 @@ export default class RemotelySavePlugin extends Plugin {
"remotely-save-cb-onedrive",
async (inputParams) => {
if (inputParams.code !== undefined) {
if (this.oauth2Info.helperModal !== undefined) {
this.oauth2Info.helperModal.contentEl.empty();
this.oauth2Info.helperModal.contentEl.createEl("p", {
text: "Connecting to Onedrive...",
});
this.oauth2Info.helperModal.contentEl.createEl("p", {
text: "Please DO NOT close this modal.",
});
}
let rsp = await sendAuthReqOnedrive(
this.settings.onedrive.clientID,
this.settings.onedrive.authority,
@ -116,13 +126,6 @@ export default class RemotelySavePlugin extends Plugin {
throw Error(`${JSON.stringify(rsp)}`);
}
if (this.oauth2Info.helperModal !== undefined) {
this.oauth2Info.helperModal.contentEl.empty();
this.oauth2Info.helperModal.contentEl.createEl("p", {
text: "Please wait, the plugin is trying to connect to Onedrive...",
});
}
rsp = rsp as AccessCodeResponseSuccessfulType;
this.settings.onedrive.accessToken = rsp.access_token;
this.settings.onedrive.accessTokenExpiresAtTime =