DEV: uses vanilla js to fetch csrf token instead of jquery (#16069)

This commit is contained in:
Joffrey JAFFEUX 2022-02-28 11:25:45 +01:00 committed by GitHub
parent c97b4d530a
commit ca7f0ce461
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -8,7 +8,10 @@ export default {
initialize(container) {
// Add a CSRF token to all AJAX requests
let session = container.lookup("session:main");
session.set("csrfToken", $("meta[name=csrf-token]").attr("content"));
session.set(
"csrfToken",
document.head.querySelector("meta[name=csrf-token]")?.content
);
if (!installed) {
$.ajaxPrefilter(callbacks.fire);