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" "url": "accounts.google.com"
}, },
"target": "electron" "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 => { return new Promise(resolve => {
const popup = window.open(authUrl, windowName); const popup = window.open(authUrl, windowName);
gloabalNS.oauthCallbacks[windowName] = () => { gloabalNS.oauthCallbacks[windowName] = url => {
const returnURL = popup.location.href;
popup.close(); popup.close();
delete gloabalNS.oauthCallbacks.windowName; delete gloabalNS.oauthCallbacks.windowName;
resolve(returnURL); resolve(url);
}; };
}); });
} }

View File

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