hotwired-laravel / turbo-laravel

This package gives you a set of conventions to make the most out of Hotwire in Laravel.
https://turbo-laravel.com
MIT License
803 stars 50 forks source link

Handling HTTP 419 #72

Closed bilogic closed 2 years ago

bilogic commented 2 years ago

There might be instances where a turbo POST to the server returns 419 due to various reasons, e.g. expired token etc.

Turbo just replaces the frame with a empty HTML. I think it would be more correct to refresh the page as a whole.

tonysm commented 2 years ago

That's up to the application developers. You can listen for the Turbo events and decide what happens when a turbo:submit-end fails or not.

In my demo app, I needed to add the CSRF token to the Turbo requests (source), that I think I can pull into the package setup.

tonysm commented 2 years ago

Actually, that snippet was already added to the package here