Better support for notes permalink

This commit is contained in:
ArthurHoaro 2020-07-28 20:46:11 +02:00
parent b725eb047d
commit 301c7ab1a0
16 changed files with 49 additions and 29 deletions
assets/default/js

View file

@ -26,11 +26,15 @@ function findParent(element, tagName, attributes) {
* Ajax request to refresh the CSRF token.
*/
function refreshToken(basePath) {
console.log('refresh');
const xhr = new XMLHttpRequest();
xhr.open('GET', `${basePath}/admin/token`);
xhr.onload = () => {
const token = document.getElementById('token');
token.setAttribute('value', xhr.responseText);
const elements = document.querySelectorAll('input[name="token"]');
[...elements].forEach((element) => {
console.log(element);
element.setAttribute('value', xhr.responseText);
});
};
xhr.send();
}