Merge pull request #6433 from betagouv/fix-autosave-null-xhr

Correction d'une erreur lors d'un échec de l'enregistrement automatique d'un brouillon
This commit is contained in:
Paul Chavard 2021-09-01 10:39:50 +02:00 committed by GitHub
commit a4c20de173
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -64,7 +64,7 @@ addEventListener('autosave:end', () => {
addEventListener('autosave:error', (event) => {
let error = event.detail;
if (error.xhr.status == 401) {
if (error.xhr && error.xhr.status == 401) {
// If we are unauthenticated, reload the page using a GET request.
// This will allow Devise to properly redirect us to sign-in, and then back to this page.
document.location.reload();