diff options
author | Whymarrh Whitby <whymarrh.whitby@gmail.com> | 2018-11-26 23:36:17 +0800 |
---|---|---|
committer | Whymarrh Whitby <whymarrh.whitby@gmail.com> | 2018-11-26 23:36:17 +0800 |
commit | 826eb82ed806772353c720d7ff736ff709539a37 (patch) | |
tree | b53c17cfbf22ed5fa545e6592be9873b46655ea9 /app/scripts/controllers | |
parent | f46d0c8d2e4b345a4262d23312ac41bdb5168367 (diff) | |
download | tangerine-wallet-browser-826eb82ed806772353c720d7ff736ff709539a37.tar tangerine-wallet-browser-826eb82ed806772353c720d7ff736ff709539a37.tar.gz tangerine-wallet-browser-826eb82ed806772353c720d7ff736ff709539a37.tar.bz2 tangerine-wallet-browser-826eb82ed806772353c720d7ff736ff709539a37.tar.lz tangerine-wallet-browser-826eb82ed806772353c720d7ff736ff709539a37.tar.xz tangerine-wallet-browser-826eb82ed806772353c720d7ff736ff709539a37.tar.zst tangerine-wallet-browser-826eb82ed806772353c720d7ff736ff709539a37.zip |
Use initState to avoid type-checking providerRequests in state
Diffstat (limited to 'app/scripts/controllers')
-rw-r--r-- | app/scripts/controllers/provider-approval.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/app/scripts/controllers/provider-approval.js b/app/scripts/controllers/provider-approval.js index 21d7fd22e..53172c069 100644 --- a/app/scripts/controllers/provider-approval.js +++ b/app/scripts/controllers/provider-approval.js @@ -22,7 +22,9 @@ class ProviderApprovalController { this.platform = platform this.preferencesController = preferencesController this.publicConfigStore = publicConfigStore - this.store = new ObservableStore() + this.store = new ObservableStore({ + providerRequests: [], + }) if (platform && platform.addMessageListener) { platform.addMessageListener(({ action = '', force, origin, siteTitle, siteImage }) => { @@ -103,7 +105,7 @@ class ProviderApprovalController { */ approveProviderRequest (origin) { this.closePopup && this.closePopup() - const requests = this.store.getState().providerRequests || [] + const requests = this.store.getState().providerRequests this.platform && this.platform.sendMessage({ action: 'approve-provider-request', selectedAddress: this.publicConfigStore.getState().selectedAddress, @@ -121,7 +123,7 @@ class ProviderApprovalController { */ rejectProviderRequest (origin) { this.closePopup && this.closePopup() - const requests = this.store.getState().providerRequests || [] + const requests = this.store.getState().providerRequests this.platform && this.platform.sendMessage({ action: 'reject-provider-request' }, { active: true }) const providerRequests = requests.filter(request => request.origin !== origin) this.store.updateState({ providerRequests }) |