update post Envelope to handle without object

This commit is contained in:
2025-09-04 18:45:00 +02:00
parent 1e1517f88a
commit 2c825d2fe3
3 changed files with 24 additions and 30 deletions

View File

@@ -275,35 +275,30 @@ class App {
// Export annotation data and save to database
try {
const json = await iJSON
const postEnvelopeResult = await this.Network.postEnvelope(
this.currentDocument.id,
json
)
const res = await this.Network.postEnvelope(this.envelopeKey, await iJSON);
if (postEnvelopeResult.fatal) {
Swal.fire({
title: 'Fehler',
text: 'Umschlag konnte nicht signiert werden!',
icon: 'error',
})
return false
}
if (postEnvelopeResult.error) {
Swal.fire({
title: 'Warnung',
text: 'Umschlag ist nicht mehr verfügbar.',
icon: 'warning',
})
return false
}
return true
if (!res.ok) {
if (res.status === 403) {
Swal.fire({
title: 'Warnung',
text: 'Umschlag ist nicht mehr verfügbar.',
icon: 'warning',
})
return false
}
else {
throw new Error()
}
} else
return true
} catch (e) {
Swal.fire({
title: 'Fehler',
text: 'Umschlag konnte nicht signiert werden!',
icon: 'error',
})
return false
}
//---
}
else
return false;

View File

@@ -15,9 +15,8 @@
* @param {any} documentId
* @param {any} json
*/
async postEnvelope(documentId, json) {
return this.postRequest(`/api/envelope?index=${documentId}`, json)
.then(this.wrapJsonResponse.bind(this))
async postEnvelope(envelopeKey, annotations) {
return this.postRequest(`/api/envelope/${envelopeKey}`, annotations)
}
/**