Commit c15e5739 authored by Wolfgang Knopki's avatar Wolfgang Knopki
Browse files

test dynamic header

parent 52fb7455
Pipeline #123 passed with stage
in 9 seconds
...@@ -22,20 +22,24 @@ function userAuthenticated(){ ...@@ -22,20 +22,24 @@ function userAuthenticated(){
} }
function readCookie(name) { function readCookie(cname) {
var nameEQ = encodeURIComponent(name) + "="; var name = cname + "=";
var ca = document.cookie.split(';'); var decodedCookie = decodeURIComponent(document.cookie);
for (var i = 0; i < ca.length; i++) { var ca = decodedCookie.split(';');
var c = ca[i]; for(var i = 0; i <ca.length; i++) {
while (c.charAt(0) === ' ') var c = ca[i];
c = c.substring(1, c.length); while (c.charAt(0) == ' ') {
if (c.indexOf(nameEQ) === 0) c = c.substring(1);
return decodeURIComponent(c.substring(nameEQ.length, c.length));
} }
return null; if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
} }
function sendRequest(URL){ function sendRequest(URL){
console.log(docuemnt.cookie);
let xhr = new XMLHttpRequest(); let xhr = new XMLHttpRequest();
xhr.open("POST", URL, true); xhr.open("POST", URL, true);
let token = readCookie("XSRF-TOKEN"); let token = readCookie("XSRF-TOKEN");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment