|
@@ -1101,11 +1101,16 @@
|
|
|
formData.append('file', selectedFile);
|
|
formData.append('file', selectedFile);
|
|
|
formData.append('custom_name', customFileName);
|
|
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 => {
|
|
.then(data => {
|
|
|
if (data.success) {
|
|
if (data.success) {
|
|
|
const uploadedFilePath = data.file_path;
|
|
const uploadedFilePath = data.file_path;
|
|
@@ -1164,8 +1169,13 @@
|
|
|
directoryModal.style.display = 'block';
|
|
directoryModal.style.display = 'block';
|
|
|
currentPage = 1;
|
|
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 => {
|
|
.then(data => {
|
|
|
if (data.success) {
|
|
if (data.success) {
|
|
|
allFiles = data.files;
|
|
allFiles = data.files;
|
|
@@ -1491,4 +1501,4 @@
|
|
|
});
|
|
});
|
|
|
</script>
|
|
</script>
|
|
|
</body>
|
|
</body>
|
|
|
-</html>
|
|
|
|
|
|
|
+</html>
|