Fix checking cloudhooks exist (#2893)

This commit is contained in:
Paulus Schoutsen 2019-03-07 10:53:24 -08:00 committed by Paulus Schoutsen
parent 3e5d372bbe
commit 836844a312
2 changed files with 7 additions and 7 deletions

View File

@ -4,6 +4,7 @@ export interface CloudWebhook {
webhook_id: string; webhook_id: string;
cloudhook_id: string; cloudhook_id: string;
cloudhook_url: string; cloudhook_url: string;
managed?: boolean;
} }
export const createCloudhook = (hass: HomeAssistant, webhookId: string) => export const createCloudhook = (hass: HomeAssistant, webhookId: string) =>

View File

@ -121,9 +121,9 @@ export class CloudWebhooks extends LitElement {
` `
: this._cloudHooks![entry.webhook_id] : this._cloudHooks![entry.webhook_id]
? html` ? html`
<mwc-button @click="${this._handleManageButton}" <mwc-button @click="${this._handleManageButton}">
>Manage</mwc-button Manage
> </mwc-button>
` `
: html` : html`
<paper-toggle-button <paper-toggle-button
@ -195,10 +195,9 @@ export class CloudWebhooks extends LitElement {
} }
private async _fetchData() { private async _fetchData() {
this._localHooks = this._localHooks = this.hass!.config.components.includes("webhook")
"webhook" in this.hass!.config.components ? await fetchWebhooks(this.hass!)
? await fetchWebhooks(this.hass!) : [];
: [];
} }
private renderStyle() { private renderStyle() {