demarches-normaliennes/app/javascript/shared
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
..
activestorage handle focus during and after upload 2021-03-17 11:31:51 +01:00
polyfills fix new prettier defaults 2020-05-12 18:18:37 +02:00
track js: ignore a new variant of the same warning 2021-09-07 16:45:52 -05:00
franceconnect.js fix new prettier defaults 2020-05-12 18:18:37 +02:00
page-update-event.js app: disable Turbolinks 2020-05-13 11:04:16 +02:00
polyfills.js Upgrade core-js 2020-02-24 19:43:07 +01:00
remote-input.js Use @utils instead of jQuery 2018-10-10 14:55:28 +02:00
remote-poller.js app: disable Turbolinks 2020-05-13 11:04:16 +02:00
safari-11-file-xhr-workaround.js fix new prettier defaults 2020-05-12 18:18:37 +02:00
toggle-target.js focus to target after toggle 2021-03-17 11:31:51 +01:00
ujs-error-handling.js js: redirect to sign-in when a ujs link_to receives a 401 2021-09-07 16:45:52 -05:00
utils.js js: document utils.ajax() 2021-07-22 11:58:02 +02:00