03-11-2023
This commit is contained in:
@@ -1,3 +1,14 @@
|
||||
var __assign = (this && this.__assign) || function () {
|
||||
__assign = Object.assign || function(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
return __assign.apply(this, arguments);
|
||||
};
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
@@ -101,7 +112,7 @@ var App = /** @class */ (function () {
|
||||
return [4 /*yield*/, App.Instance.create(annotations)];
|
||||
case 7:
|
||||
createdAnnotations = _b.sent();
|
||||
description = "Umschlag wurde geöffnet";
|
||||
description = "Umschlag wurde ge<EFBFBD>ffnet";
|
||||
return [4 /*yield*/, App.Network.postHistory(App.envelopeKey, ActionType.Seen, description)];
|
||||
case 8:
|
||||
_b.sent();
|
||||
@@ -127,10 +138,10 @@ var App = /** @class */ (function () {
|
||||
case 2:
|
||||
result = _b.sent();
|
||||
if (result == true) {
|
||||
alert("Dokument zurückgesetzt!");
|
||||
alert("Dokument zur<EFBFBD>ckgesetzt!");
|
||||
}
|
||||
else {
|
||||
alert("Fehler beim Zurücksetzen des Dokuments!");
|
||||
alert("Fehler beim Zur<EFBFBD>cksetzen des Dokuments!");
|
||||
}
|
||||
return [3 /*break*/, 5];
|
||||
case 3: return [4 /*yield*/, App.handleFinish(null)];
|
||||
@@ -141,7 +152,7 @@ var App = /** @class */ (function () {
|
||||
alert("Dokument erfolgreich signiert!");
|
||||
}
|
||||
else {
|
||||
alert("Fehler beim Abschließen des Dokuments!");
|
||||
alert("Fehler beim Abschlie<EFBFBD>en des Dokuments!");
|
||||
}
|
||||
return [3 /*break*/, 5];
|
||||
case 5: return [2 /*return*/];
|
||||
@@ -216,7 +227,7 @@ var App = /** @class */ (function () {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var result;
|
||||
return __generator(this, function (_a) {
|
||||
if (confirm("Wollen Sie das Dokument und alle erstellten Signaturen zurücksetzen?")) {
|
||||
if (confirm("Wollen Sie das Dokument und alle erstellten Signaturen zur<EFBFBD>cksetzen?")) {
|
||||
result = App.Annotation.deleteAnnotations(App.Instance);
|
||||
return [2 /*return*/, true];
|
||||
}
|
||||
@@ -336,11 +347,11 @@ var Network = /** @class */ (function () {
|
||||
function Network() {
|
||||
}
|
||||
Network.prototype.getEnvelope = function (envelopeKey) {
|
||||
return fetch("/api/envelope/".concat(envelopeKey), { credentials: "include" })
|
||||
return fetch("/api/envelope/".concat(envelopeKey), this.withCSRFToken({ credentials: "include" }))
|
||||
.then(function (res) { return res.json(); });
|
||||
};
|
||||
Network.prototype.getDocument = function (envelopeKey, documentId) {
|
||||
return fetch("/api/document/".concat(envelopeKey, "?index=").concat(documentId), { credentials: "include" })
|
||||
return fetch("/api/document/".concat(envelopeKey, "?index=").concat(documentId), this.withCSRFToken({ credentials: "include" }))
|
||||
.then(function (res) { return res.arrayBuffer(); });
|
||||
};
|
||||
Network.prototype.postDocument = function (envelopeKey, documentId, buffer) {
|
||||
@@ -351,7 +362,7 @@ var Network = /** @class */ (function () {
|
||||
body: buffer
|
||||
};
|
||||
console.debug("PostDocument/Calling url: " + url);
|
||||
return fetch(url, options)
|
||||
return fetch(url, this.withCSRFToken(options))
|
||||
.then(this.handleResponse)
|
||||
.then(function (res) {
|
||||
if (!res.ok) {
|
||||
@@ -369,7 +380,7 @@ var Network = /** @class */ (function () {
|
||||
body: jsonString
|
||||
};
|
||||
console.debug("PostEnvelope/Calling url: " + url);
|
||||
return fetch(url, options)
|
||||
return fetch(url, this.withCSRFToken(options))
|
||||
.then(this.handleResponse)
|
||||
.then(function (res) {
|
||||
if (!res.ok) {
|
||||
@@ -394,7 +405,7 @@ var Network = /** @class */ (function () {
|
||||
body: JSON.stringify(data)
|
||||
};
|
||||
console.debug("PostHistory/Calling url: " + url);
|
||||
return fetch(url, options)
|
||||
return fetch(url, this.withCSRFToken(options))
|
||||
.then(this.handleResponse)
|
||||
.then(function (res) {
|
||||
if (!res.ok) {
|
||||
@@ -404,6 +415,12 @@ var Network = /** @class */ (function () {
|
||||
return true;
|
||||
});
|
||||
};
|
||||
Network.prototype.withCSRFToken = function (options) {
|
||||
var token = document.getElementsByName("__RequestVerificationToken")[0].value;
|
||||
var headers = options.headers;
|
||||
options.headers = __assign(__assign({}, headers), { 'X-XSRF-TOKEN': token });
|
||||
return options;
|
||||
};
|
||||
Network.prototype.handleResponse = function (res) {
|
||||
if (!res.ok) {
|
||||
console.log("Request failed with status ".concat(res.status));
|
||||
@@ -435,7 +452,7 @@ var UI = /** @class */ (function () {
|
||||
type: "custom",
|
||||
id: "button-reset",
|
||||
className: "button-reset",
|
||||
title: "Zurücksetzen",
|
||||
title: "Zur<EFBFBD>cksetzen",
|
||||
onPress: function () {
|
||||
callback("RESET");
|
||||
},
|
||||
@@ -445,7 +462,7 @@ var UI = /** @class */ (function () {
|
||||
type: "custom",
|
||||
id: "button-finish",
|
||||
className: "button-finish",
|
||||
title: "Abschließen",
|
||||
title: "Abschlie<EFBFBD>en",
|
||||
onPress: function () {
|
||||
callback("FINISH");
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user