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,7 +201,8 @@ class HassioBackupDialog
} }
if (!this._dialogParams?.onboarding) { if (!this._dialogParams?.onboarding) {
this.hass!.callApi( try {
await this.hass!.callApi(
"POST", "POST",
`hassio/${ `hassio/${
@ -210,17 +211,14 @@ class HassioBackupDialog
: "snapshots" : "snapshots"
}/${this._backup!.slug}/restore/partial`, }/${this._backup!.slug}/restore/partial`,
backupDetails backupDetails
).then( );
() => {
this.closeDialog(); this.closeDialog();
}, } catch (error: any) {
(error) => {
this._error = error.body.message; 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),
}); });