correct html
This commit is contained in:
parent
cd6f6a924b
commit
f0f5be40e9
@ -13,7 +13,7 @@
|
|||||||
<!-- Адаптив -->
|
<!-- Адаптив -->
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
|
<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="https://snipp.ru/cdn/jquery/2.1.1/jquery.min.js"></script>
|
||||||
<script src="js/button"></script>
|
<script src="js/button.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
@ -51,7 +51,12 @@
|
|||||||
let formData = new FormData();
|
let formData = new FormData();
|
||||||
formData.append("file", file);
|
formData.append("file", file);
|
||||||
let fileDown = file.name.replace(/\.[^.]+$/, "")
|
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", {
|
fetch("https://sirius.gitstore.ru/api/sirius", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@ -59,7 +64,7 @@
|
|||||||
})
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`HTTP ${response.status} - ${response.statusText}`);
|
throw new Error(`HTTP ${response.status} - ${response.body}`);
|
||||||
}
|
}
|
||||||
return response.blob();
|
return response.blob();
|
||||||
})
|
})
|
||||||
@ -76,7 +81,8 @@
|
|||||||
setTimeout(() => { URL.revokeObjectURL(downloadUrl) }, 1000);
|
setTimeout(() => { URL.revokeObjectURL(downloadUrl) }, 1000);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
throw err;
|
alert(err);
|
||||||
|
return
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user