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:
parent
5e07278e87
commit
1ec90e34f5
1 changed files with 6 additions and 6 deletions
|
@ -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 || "";
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue