summaryrefslogtreecommitdiff
path: root/srv/src/http/tpl/load-csrf.html
blob: b0757f9a215e369a5179f9d7b628896cdf443c18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
<script async type="module" src="{{ StaticURL "api.js" }}"></script>

<script type="text/javascript">
  (async () => {
    const api = await import("{{ StaticURL "api.js" }}");
    const res = await api.call("/api/csrf");

    const els = document.getElementsByClassName("csrfHiddenInput");
    for (let i = 0; i < els.length; i++) {
      els[i].value = res.CSRFToken;
    }
  })();
</script>