Optimize data handling by embedding EnvelopeResponse in Razor Page, eliminating additional requests
This commit is contained in:
@@ -10,7 +10,7 @@ const ActionType = {
|
||||
}
|
||||
|
||||
class App {
|
||||
constructor(container, envelopeKey) {
|
||||
constructor(container, envelopeKey, envelopeResponse) {
|
||||
this.container = container
|
||||
this.envelopeKey = envelopeKey
|
||||
|
||||
@@ -22,33 +22,15 @@ class App {
|
||||
this.currentDocument = null
|
||||
this.currentReceiver = null
|
||||
this.signatureCount = 0
|
||||
this.envelopeResponse = envelopeResponse;
|
||||
}
|
||||
|
||||
// This function will be called from the ShowEnvelope.razor page
|
||||
// and will trigger loading of the Editor Interface
|
||||
async init() {
|
||||
// Load the envelope from the database
|
||||
console.debug('Loading envelope from database..')
|
||||
const envelopeResponse = await this.Network.getEnvelope(this.envelopeKey)
|
||||
|
||||
if (envelopeResponse.fatal) {
|
||||
return Swal.fire({
|
||||
title: 'Fehler',
|
||||
text: 'Umschlag konnte nicht geladen werden!',
|
||||
icon: 'error',
|
||||
})
|
||||
}
|
||||
|
||||
if (envelopeResponse.error) {
|
||||
return Swal.fire({
|
||||
title: 'Warnung',
|
||||
text: 'Umschlag ist nicht mehr verfügbar.',
|
||||
icon: 'warning',
|
||||
})
|
||||
}
|
||||
|
||||
this.currentDocument = envelopeResponse.data.envelope.documents[0]
|
||||
this.currentReceiver = envelopeResponse.data.receiver
|
||||
this.currentDocument = this.envelopeResponse.envelope.documents[0]
|
||||
this.currentReceiver = this.envelopeResponse.receiver
|
||||
|
||||
// Load the document from the filestore
|
||||
console.debug('Loading document from filestore')
|
||||
|
||||
Reference in New Issue
Block a user