summaryrefslogtreecommitdiff
path: root/templates/js
diff options
context:
space:
mode:
Diffstat (limited to 'templates/js')
-rw-r--r--templates/js/admin.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/templates/js/admin.js b/templates/js/admin.js
index 4dff572..0b26e2f 100644
--- a/templates/js/admin.js
+++ b/templates/js/admin.js
@@ -7,8 +7,11 @@
* @returns {Promise<Response>}
*/
async function fetchApi(url, options = {}) {
+ const csrfToken = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
+
options.headers = {
...options.headers,
+ 'X-CSRF-Token': csrfToken
};
// Set content type for methods that have a body.