convert csrfToken constan variable

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

View File

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