Skip to content

Commit

Permalink
feat htmx用の設定をmain.jsに追加
Browse files Browse the repository at this point in the history
  • Loading branch information
flour621 committed Aug 29, 2024
1 parent d368819 commit 25dfbc7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/develop/src/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ async function main() {
*/
window.htmx = htmx;

addEventListener("htmx:configRequest", function(event) {
const csrfToken = document.querySelector('meta[name="csrf-token"]').content;
event.detail.headers['X-CSRF-Token'] = csrfToken;
});

addEventListener('htmx:beforeHistoryUpdate', function (event) {
const proposedUrl = event.detail.history.path;
let customUrl = proposedUrl;
Expand Down

0 comments on commit 25dfbc7

Please sign in to comment.