convert csrfToken to get method

This commit is contained in:
2025-09-09 18:11:14 +02:00
parent 1ac2a476d2
commit 207bc8bcbd
4 changed files with 16 additions and 4 deletions

View File

@@ -1,7 +1,9 @@
/**
* Fetches CSRF Token from page
*/
const csrfToken = { 'X-XSRF-TOKEN': document.getElementsByName('__RequestVerificationToken')[0].value };
function getCsrfToken() {
return { 'X-XSRF-TOKEN': document.getElementsByName('__RequestVerificationToken')[0].value }
}
/**
* Save signature data to server
@@ -9,7 +11,7 @@ const csrfToken = { 'X-XSRF-TOKEN': document.getElementsByName('__RequestVerific
* @param {any} annotations
*/
function postEnvelope(annotations) {
const token = csrfToken
const token = getCsrfToken()
const options = {
credentials: 'include',
method: 'POST',