Skip to content

Commit

Permalink
Fixed csrf token loading for axios after login
Browse files Browse the repository at this point in the history
  • Loading branch information
tabuna committed Nov 23, 2024
1 parent 8b846d9 commit 958948d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions resources/js/controllers/html_load_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ export default class extends ApplicationController {
initialize() {
this.axios();
this.csrf();

/**
* Ensures the CSRF token is updated for pages that were reloaded,
* such as when a user logs into the system.
*/
window.addEventListener('turbo:load', () => this.csrf());
}

/**
Expand Down

0 comments on commit 958948d

Please sign in to comment.