10 lines
326 B
JavaScript
10 lines
326 B
JavaScript
document.addEventListener("DOMContentLoaded", () => {
|
|
const token = document.querySelector("meta[name='csrf-token']")?.getAttribute("content");
|
|
if (!token || !window.htmx || !window.htmx.on) {
|
|
return;
|
|
}
|
|
|
|
window.htmx.on("htmx:configRequest", (event) => {
|
|
event.detail.headers["X-CSRF-Token"] = token;
|
|
});
|
|
});
|