correct html

This commit is contained in:
Anatoly Prohacky 2023-04-23 19:08:08 +10:00
parent cd6f6a924b
commit f0f5be40e9

View File

@ -13,7 +13,7 @@
<!-- Адаптив -->
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<script src="https://snipp.ru/cdn/jquery/2.1.1/jquery.min.js"></script>
<script src="js/button"></script>
<script src="js/button.js"></script>
</head>
<body>
@ -51,7 +51,12 @@
let formData = new FormData();
formData.append("file", file);
let fileDown = file.name.replace(/\.[^.]+$/, "")
let fileRes = file.name.split('').reverse().join('').split('.')[0].split('').reverse().join('');
if (fileRes != "json") {
alert(`Format file not json`);
return
}
fetch("https://sirius.gitstore.ru/api/sirius", {
method: "POST",
@ -59,7 +64,7 @@
})
.then(response => {
if (!response.ok) {
throw new Error(`HTTP ${response.status} - ${response.statusText}`);
throw new Error(`HTTP ${response.status} - ${response.body}`);
}
return response.blob();
})
@ -76,7 +81,8 @@
setTimeout(() => { URL.revokeObjectURL(downloadUrl) }, 1000);
})
.catch((err) => {
throw err;
alert(err);
return
});
}
</script>