improve finish handling

This commit is contained in:
Jonathan Jenne
2023-10-11 12:35:30 +02:00
parent 8d5e24c6a7
commit e69dccb2e1
5 changed files with 50 additions and 23 deletions

View File

@@ -133,16 +133,12 @@ var App = /** @class */ (function () {
json = _a.sent();
console.log(json);
console.log(JSON.stringify(json));
return [4 /*yield*/, App.Network.postEnvelope(App.envelopeKey, App.currentDocument.id, JSON.stringify(json))
// Flatten the annotations and save the document to disk
/*
const buffer = await App.Instance.exportPDF({ flatten: true });
const result = await App.Network.postDocument(App.envelopeKey, App.currentDocument.id, buffer);
console.log(result)
*/
];
return [4 /*yield*/, App.Network.postEnvelope(App.envelopeKey, App.currentDocument.id, JSON.stringify(json))];
case 3:
result = _a.sent();
if (result == true) {
alert("Dokument erfolgreich signiert!");
}
return [2 /*return*/];
}
});
@@ -286,11 +282,24 @@ var Network = /** @class */ (function () {
body: jsonString
};
return fetch("/api/envelope/".concat(envelopeKey, "?index=").concat(documentId), options)
.then(this.handleResponse)
.then(function (res) {
console.log(res);
res.json();
if (!res.ok) {
return false;
}
;
return true;
});
};
Network.prototype.handleResponse = function (res) {
if (!res.ok) {
console.log("Request failed with status ".concat(res.status));
return res;
}
else {
return res;
}
};
return Network;
}());
var UI = /** @class */ (function () {