mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-23 09:16:38 +00:00
Refresh account status while connecting (#727)
* Refresh account status while connecting * Lint
This commit is contained in:
parent
aa5ff72710
commit
0904af2ad2
@ -88,7 +88,10 @@ class HaConfigCloudAccount extends window.hassMixins.EventsMixin(Polymer.Element
|
|||||||
static get properties() {
|
static get properties() {
|
||||||
return {
|
return {
|
||||||
hass: Object,
|
hass: Object,
|
||||||
account: Object,
|
account: {
|
||||||
|
type: Object,
|
||||||
|
observer: '_accountChanged',
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,6 +102,23 @@ class HaConfigCloudAccount extends window.hassMixins.EventsMixin(Polymer.Element
|
|||||||
_formatExpiration(date) {
|
_formatExpiration(date) {
|
||||||
return window.hassUtil.formatDateTime(new Date(date));
|
return window.hassUtil.formatDateTime(new Date(date));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_accountChanged(newAccount) {
|
||||||
|
if (newAccount.cloud !== 'connecting') {
|
||||||
|
if (this._accountUpdater) {
|
||||||
|
clearTimeout(this._accountUpdater);
|
||||||
|
this._accountUpdater = null;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
} else if (this._accountUpdater) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
this._accountUpdater = null;
|
||||||
|
this.hass.callApi('get', 'cloud/account')
|
||||||
|
.then(account => this.fire('ha-account-refreshed', { account }));
|
||||||
|
}, 5000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
customElements.define(HaConfigCloudAccount.is, HaConfigCloudAccount);
|
customElements.define(HaConfigCloudAccount.is, HaConfigCloudAccount);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user