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)] [Authorize(Roles = ReceiverRole.FullyAuth)]
[HttpPost("{envelopeKey}")] [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 // get claims
var signature = User.GetAuthReceiverSignature(); var signature = User.GetAuthReceiverSignature();
@ -66,7 +66,7 @@ public class EnvelopeController : ControllerBase
await _mediator.Publish(notification, cancel); await _mediator.Publish(notification, cancel);
return Ok(new object()); return Ok();
} }
[Authorize(Roles = ReceiverRole.FullyAuth)] [Authorize(Roles = ReceiverRole.FullyAuth)]

View File

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

View File

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