1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-16 18:01:37 +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(); window.location.reload();
} }
/**
* Get the CSRF token from the HTML document.
*
* @returns {string} The CSRF token.
*/
function getCsrfToken() { function getCsrfToken() {
const element = document.querySelector("body[data-csrf-token]"); return document.body.dataset.csrfToken || "";
if (element !== null) {
return element.dataset.csrfToken;
}
return "";
} }
/** /**