root 7 ore fa
parent
commit
4f0807f4cb
1 ha cambiato i file con 18 aggiunte e 8 eliminazioni
  1. 18 8
      static/web/viewer.html

+ 18 - 8
static/web/viewer.html

@@ -1101,11 +1101,16 @@
                     formData.append('file', selectedFile);
                     formData.append('custom_name', customFileName);
 
-                    fetch('http://117.50.195.224:8005/upload-pdf', {
-                        method: 'POST',
-                        body: formData
-                    })
-                        .then(response => response.json())
+                    fetch('/upload-pdf', {
+                        method: 'POST',
+                        body: formData
+                    })
+                        .then(response => {
+                            if (!response.ok) {
+                                throw new Error(`HTTP ${response.status}`);
+                            }
+                            return response.json();
+                        })
                         .then(data => {
                             if (data.success) {
                                 const uploadedFilePath = data.file_path;
@@ -1164,8 +1169,13 @@
                     directoryModal.style.display = 'block';
                     currentPage = 1;
 
-                    fetch('http://117.50.195.224:8005/list-pdfs')
-                        .then(response => response.json())
+                    fetch('/list-pdfs')
+                        .then(response => {
+                            if (!response.ok) {
+                                throw new Error(`HTTP ${response.status}`);
+                            }
+                            return response.json();
+                        })
                         .then(data => {
                             if (data.success) {
                                 allFiles = data.files;
@@ -1491,4 +1501,4 @@
                 });
             </script>
 </body>
-</html>
+</html>