demarches-normaliennes/app
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
..
assets i18n: display selected locale as active wit bold text 2021-08-24 12:57:51 -05:00
controllers feat(graphql): add an option to dossier state change mutations to disable notifications 2021-09-07 14:21:48 +02:00
dashboards manager: localize dossier enums 2021-05-06 14:41:08 +02:00
fields manager: remove support for old pj 2019-07-30 16:11:17 +02:00
graphql feat(graphql): add an option to dossier state change mutations to disable notifications 2021-09-07 14:21:48 +02:00
helpers i18n: localize dossiers edition 2021-07-20 14:18:20 +02:00
javascript js: redirect to sign-in when a ujs link_to receives a 401 2021-09-07 16:45:52 -05:00
jobs purge old sendinblue mails 2021-08-20 08:52:39 +02:00
lib purge old sendinblue mails 2021-08-20 08:52:39 +02:00
mailers feat(i18n): send dossier emails with its user locale and improuve translations 2021-09-07 09:51:23 +02:00
models models: ensure Champs::Pays#to_s is always a string 2021-09-07 10:47:18 -05:00
policies policies: clarify the role of ChampPolicy 2020-06-24 15:42:30 +02:00
schemas Add api address external data fetch 2021-02-17 19:10:16 +01:00
serializers modify experts avis controllers, concern and serializer 2021-03-18 11:38:52 +01:00
services fix(virus scan): prevent virus scan on archives and signatures uploads 2021-09-07 14:21:48 +02:00
validators Add geo json validation 2021-03-11 15:51:09 +01:00
views feat(i18n): send dossier emails with its user locale and improuve translations 2021-09-07 09:51:23 +02:00