Random fixes (#1276)

This commit is contained in:
Paulus Schoutsen 2018-06-12 09:27:46 -04:00 committed by GitHub
parent 7f93317314
commit 0b6214be2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -17,6 +17,7 @@ class HaMarkdown extends EventsMixin(PolymerElement) {
}
connectedCallback() {
super.connectedCallback();
// 0 = not loaded, 1 = success, 2 = error
this._scriptLoaded = 0;
this._renderScheduled = false;

View File

@ -226,7 +226,7 @@ class HomeAssistant extends LocalizeMixin(PolymerElement) {
const host = window.location.protocol + '//' + window.location.host;
const auth = conn.options;
return hassCallApi(host, auth, method, path, parameters).catch((err) => {
if (err.status_code !== 401 || !auth.accessToken) throw err;
if (!err || err.status_code !== 401 || !auth.accessToken) throw err;
// If we connect with access token and get 401, refresh token and try again
return window.refreshToken().then((accessToken) => {