From 301c7ab1a079d937ab41c6f52b8804e5731008e6 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Tue, 28 Jul 2020 20:46:11 +0200 Subject: Better support for notes permalink --- assets/default/js/base.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'assets/default') diff --git a/assets/default/js/base.js b/assets/default/js/base.js index 76e4fe2a..0f29799d 100644 --- a/assets/default/js/base.js +++ b/assets/default/js/base.js @@ -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(); } -- cgit v1.2.3