Skip to content

Commit

Permalink
Call repositorySetVersion when selecting version to download (#549)
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeeus committed Dec 26, 2021
1 parent eaef31c commit 68bdcae
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/components/dialogs/hacs-download-dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
getRepositories,
repositoryInstall,
repositoryInstallVersion,
repositorySetVersion,
repositoryToggleBeta,
repositoryUpdate,
} from "../../data/websocket";
Expand Down Expand Up @@ -196,9 +197,19 @@ export class HacsDonwloadDialog extends HacsDialogBase {
}

private async _valueChanged(ev) {
let updateNeeded = false;
if (this._downloadRepositoryData.beta !== ev.detail.value.beta) {
updateNeeded = true;
this._toggle = true;
await repositoryToggleBeta(this.hass, this.repository!);
}
if (ev.detail.value.version) {
updateNeeded = true;
this._toggle = true;

await repositorySetVersion(this.hass, this.repository!, ev.detail.value.version);
}
if (updateNeeded) {
const repositories = await getRepositories(this.hass);
this.dispatchEvent(
new CustomEvent("update-hacs", {
Expand Down

0 comments on commit 68bdcae

Please sign in to comment.