demarches-normaliennes/app/javascript
Pierre de La Morinerie 8dce7d59ed js: redirect to sign-in when a ujs link_to receives a 401
Before, when a 401 was received by a ujs-enabled link (like `link_to …,
method: :delete, data: { remote: true }`, rails-ujs tried to insert the
response text as a Javascript script.

As the script was something like `Please sign-in`, which is not valid
Javascript, the browser would throw an "Unexpected token" error.

The typical use-case is:

1. The user open a form in a tab,
2. The user disconnects in another tab,
3. In the first tab, the user clicks on a remote "Delete" link_to

In that case the browser raised an error in the console (and in Sentry),
but the user would see nothing.

With this commit, all 401 ujs errors are turned into redirects to the
sign-in page.

Fix https://sentry.io/organizations/demarches-simplifiees/issues/2522512693/activity/
2021-09-07 16:45:52 -05:00
..
components Update photographies-aeriennes basemap URL 2021-09-01 21:58:12 +02:00
loaders create ComboMultipleDropdownList component 2021-02-16 16:47:14 +01:00
manager/fields Explicitly import jQuery 2018-08-13 15:17:13 +02:00
new_design js: fix null xhr in autosave error handling 2021-08-31 14:54:02 -05:00
packs js: redirect to sign-in when a ujs link_to receives a 401 2021-09-07 16:45:52 -05:00
shared js: redirect to sign-in when a ujs link_to receives a 401 2021-09-07 16:45:52 -05:00