Procházet zdrojové kódy

fix(navbar): improve error handling and user feedback during web update process

Manuel před 2 týdny
rodič
revize
65c68e7ecf
1 změnil soubory, kde provedl 9 přidání a 1 odebrání
  1. 9 1
      templates/components/navbar.html

+ 9 - 1
templates/components/navbar.html

@@ -833,7 +833,15 @@
             alert({{ _('Error al actualizar la aplicación web')|tojson }});
           }
         } catch (error) {
-          alert({{ _('Error de conexión')|tojson }});
+          // The web update restarts the service, which can close this request
+          // before fetch receives the final response.
+          const restartMessage = {{ _('La actualización se inició correctamente. La aplicación se está reiniciando.')|tojson }};
+          if (window.toastr) {
+            toastr.success(restartMessage);
+          } else {
+            alert(restartMessage);
+          }
+          setTimeout(() => window.location.reload(), 2500);
         }
       }
     );