Await backup restore (#13167)

This commit is contained in:
Joakim Sørensen 2022-07-11 12:50:37 +02:00 committed by GitHub
parent da709cbbd1
commit cd4f6e19f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -201,26 +201,24 @@ class HassioBackupDialog
} }
if (!this._dialogParams?.onboarding) { if (!this._dialogParams?.onboarding) {
this.hass!.callApi( try {
"POST", await this.hass!.callApi(
"POST",
`hassio/${ `hassio/${
atLeastVersion(this.hass!.config.version, 2021, 9) atLeastVersion(this.hass!.config.version, 2021, 9)
? "backups" ? "backups"
: "snapshots" : "snapshots"
}/${this._backup!.slug}/restore/partial`, }/${this._backup!.slug}/restore/partial`,
backupDetails backupDetails
).then( );
() => { this.closeDialog();
this.closeDialog(); } catch (error: any) {
}, this._error = error.body.message;
(error) => { }
this._error = error.body.message;
}
);
} else { } else {
fireEvent(this, "restoring"); fireEvent(this, "restoring");
fetch(`/api/hassio/backups/${this._backup!.slug}/restore/partial`, { await fetch(`/api/hassio/backups/${this._backup!.slug}/restore/partial`, {
method: "POST", method: "POST",
body: JSON.stringify(backupDetails), body: JSON.stringify(backupDetails),
}); });