fix(dropbox-auth): In Electron.

This commit is contained in:
Hristo Terezov 2019-02-27 15:29:41 +00:00
parent 5739e1deaa
commit 55149670da
3 changed files with 9 additions and 5 deletions

View File

@ -4,5 +4,11 @@
"url": "accounts.google.com"
},
"target": "electron"
},
"dropbox-auth": {
"matchPatterns": {
"url": "dropbox.com/oauth2/authorize"
},
"target": "electron"
}
}

View File

@ -23,12 +23,10 @@ function authorize(authUrl: string): Promise<string> {
return new Promise(resolve => {
const popup = window.open(authUrl, windowName);
gloabalNS.oauthCallbacks[windowName] = () => {
const returnURL = popup.location.href;
gloabalNS.oauthCallbacks[windowName] = url => {
popup.close();
delete gloabalNS.oauthCallbacks.windowName;
resolve(returnURL);
resolve(url);
};
});
}

View File

@ -16,7 +16,7 @@
if (globalNS.oauthCallbacks
&& typeof globalNS.oauthCallbacks[windowName]
=== 'function') {
globalNS.oauthCallbacks[windowName]();
globalNS.oauthCallbacks[windowName](window.location.href);
}
}
})();