1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

bugfix: reject enable promise on user rejection

This commit is contained in:
bitpshr 2019-05-31 16:07:58 -04:00
parent d837703546
commit e8f6dff0be

View File

@ -33,8 +33,8 @@ inpageProvider.setMaxListeners(100)
inpageProvider.enable = function ({ force } = {}) {
return new Promise((resolve, reject) => {
inpageProvider.sendAsync({ method: 'eth_requestAccounts', params: [force] }, (error, response) => {
if (error) {
reject(error)
if (error || response.error) {
reject(error || response.error)
} else {
resolve(response.result)
}