update post Envelope to handle without object

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

View File

@ -44,7 +44,7 @@ public class EnvelopeController : ControllerBase
[Authorize(Roles = ReceiverRole.FullyAuth)]
[HttpPost("{envelopeKey}")]
public async Task<IActionResult> CreateOrUpdate([FromRoute] string envelopeKey, int index, [FromBody] ExpandoObject annotations, CancellationToken cancel = default)
public async Task<IActionResult> CreateOrUpdate([FromRoute] string envelopeKey, [FromBody] ExpandoObject annotations, CancellationToken cancel = default)
{
// get claims
var signature = User.GetAuthReceiverSignature();
@ -66,7 +66,7 @@ public class EnvelopeController : ControllerBase
await _mediator.Publish(notification, cancel);
return Ok(new object());
return Ok();
}
[Authorize(Roles = ReceiverRole.FullyAuth)]

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)
}
/**