diff options
author | ArthurHoaro <arthur@hoa.ro> | 2020-07-28 20:46:11 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2020-07-28 20:46:11 +0200 |
commit | 301c7ab1a079d937ab41c6f52b8804e5731008e6 (patch) | |
tree | da6a5ed2a436fea87a3fe83fe72483c3f07c5826 /assets/default/js | |
parent | b725eb047d233d6c7a505f160b57ebc399a24d45 (diff) | |
download | Shaarli-301c7ab1a079d937ab41c6f52b8804e5731008e6.tar.gz Shaarli-301c7ab1a079d937ab41c6f52b8804e5731008e6.tar.zst Shaarli-301c7ab1a079d937ab41c6f52b8804e5731008e6.zip |
Better support for notes permalink
Diffstat (limited to 'assets/default/js')
-rw-r--r-- | assets/default/js/base.js | 8 |
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 | */ |
28 | function refreshToken(basePath) { | 28 | function 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 | } |