Update cookie

pull/7271/head
Cagatay Civici 2025-02-18 00:22:10 +03:00
parent d42b04c3d7
commit 1a99a505eb
1 changed files with 15 additions and 5 deletions

View File

@ -230,12 +230,22 @@ export default {
this.refreshACTokens();
},
getCSRFToken() {
const name = '_p_csrf_token';
const value = `; ${document.cookie}`;
const parts = value.split(`; ${name}=`);
const cookie = this.getCookie('_p_csrf_token');
console.log('CSRF Cookie:' + cookie);
return cookie;
},
getCookie(name) {
var cookieArr = document.cookie.split(";");
if (parts.length === 2) return parts.pop().split(';').shift();
else return null;
for(var i = 0; i < cookieArr.length; i++) {
var cookiePair = cookieArr[i].split("=");
if(name == cookiePair[0].trim()) {
return decodeURIComponent(cookiePair[1]);
}
}
return null;
}
},
computed: {