mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 02:22:21 +00:00
frontend: Add error handling to collection forms
This commit is contained in:
@@ -63,7 +63,7 @@ export class EditAddressbookForm extends LitElement {
|
||||
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,12 @@ export class EditAddressbookForm extends LitElement {
|
||||
`
|
||||
|
||||
})
|
||||
|
||||
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