don't refresh page with new id unless the save worked

This commit is contained in:
Jesper Møller Jensen
2023-12-13 16:29:40 +13:00
parent 7778669f08
commit 0ea6d2a496

View File

@@ -57,12 +57,16 @@ export class UmbRelationTypeWorkspaceContext
if (!this.#data.value) return;
if (!this.#data.value.id) return;
let response = undefined;
if (this.getIsNew()) {
await this.repository.create(this.#data.value);
response = await this.repository.create(this.#data.value);
} else {
await this.repository.save(this.#data.value.id, this.#data.value);
response = await this.repository.save(this.#data.value.id, this.#data.value);
}
if (response.error) return;
// If it went well, then its not new anymore?.
this.setIsNew(false);
}