aboutsummaryrefslogtreecommitdiffhomepage
path: root/assets/default/js/base.js
diff options
context:
space:
mode:
Diffstat (limited to 'assets/default/js/base.js')
-rw-r--r--assets/default/js/base.js8
1 files changed, 6 insertions, 2 deletions
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) {
26 * Ajax request to refresh the CSRF token. 26 * Ajax request to refresh the CSRF token.
27 */ 27 */
28function refreshToken(basePath) { 28function refreshToken(basePath) {
29 console.log('refresh');
29 const xhr = new XMLHttpRequest(); 30 const xhr = new XMLHttpRequest();
30 xhr.open('GET', `${basePath}/admin/token`); 31 xhr.open('GET', `${basePath}/admin/token`);
31 xhr.onload = () => { 32 xhr.onload = () => {
32 const token = document.getElementById('token'); 33 const elements = document.querySelectorAll('input[name="token"]');
33 token.setAttribute('value', xhr.responseText); 34 [...elements].forEach((element) => {
35 console.log(element);
36 element.setAttribute('value', xhr.responseText);
37 });
34 }; 38 };
35 xhr.send(); 39 xhr.send();
36} 40}