mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 01:12:24 +00:00
frontend: Add error handling to collection forms
This commit is contained in:
@@ -64,7 +64,7 @@ let EditAddressbookForm = class extends i {
|
||||
alert("Empty displayname");
|
||||
return;
|
||||
}
|
||||
await fetch(`/carddav/principal/${this.principal}/${this.addr_id}`, {
|
||||
let response = await fetch(`/carddav/principal/${this.principal}/${this.addr_id}`, {
|
||||
method: "PROPPATCH",
|
||||
headers: {
|
||||
"Content-Type": "application/xml"
|
||||
@@ -85,6 +85,10 @@ let EditAddressbookForm = class extends i {
|
||||
</propertyupdate>
|
||||
`
|
||||
});
|
||||
if (response.status >= 400) {
|
||||
alert(`Error ${response.status}: ${await response.text()}`);
|
||||
return null;
|
||||
}
|
||||
window.location.reload();
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user