convert csrfToken constan variable

This commit is contained in:
2025-09-04 23:07:32 +02:00
parent c479ea4179
commit 77070a8cfc

View File

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