Move error to the is valid check

This commit is contained in:
Franck Nijhof 2021-03-12 12:49:53 +01:00
parent f64b96ac5d
commit c4fd846451
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3

View File

@ -199,6 +199,15 @@ class HaPanelDevService extends LitElement {
if (!serviceData?.service) {
return false;
}
this._error = undefined;
if (hasTemplate(this._serviceData!)) {
this._error = this.hass.localize(
"ui.panel.developer-tools.tabs.services.no_templates"
);
return false;
}
const domain = computeDomain(serviceData.service);
const service = computeObjectId(serviceData.service);
if (!domain || !service) {
@ -260,14 +269,6 @@ class HaPanelDevService extends LitElement {
return;
}
this._error = undefined;
if (hasTemplate(this._serviceData!)) {
this._error = this.hass.localize(
"ui.panel.developer-tools.tabs.services.no_templates"
);
return;
}
this.hass.callService(
domain,
service,