1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-11 17:51:01 +00:00

refactor(js): simplify CSRF token retrieval from the document

This commit is contained in:
Frédéric Guillot 2025-08-01 20:38:54 -07:00
parent 5e07278e87
commit 1ec90e34f5

View file

@ -806,13 +806,13 @@ async function checkShareAPI(title, url) {
window.location.reload();
}
/**
* Get the CSRF token from the HTML document.
*
* @returns {string} The CSRF token.
*/
function getCsrfToken() {
const element = document.querySelector("body[data-csrf-token]");
if (element !== null) {
return element.dataset.csrfToken;
}
return "";
return document.body.dataset.csrfToken || "";
}
/**