animation et responsive
This commit is contained in:
+39
-17
@@ -290,30 +290,52 @@ document
|
||||
|
||||
|
||||
|
||||
const response =
|
||||
await fetch(
|
||||
"/edt.pdf",
|
||||
{
|
||||
const submitButton = document.getElementById("submit-button");
|
||||
|
||||
const loader =
|
||||
document.querySelector(".loader");
|
||||
|
||||
const iframe =
|
||||
document.getElementById("pdf_iframe");
|
||||
|
||||
|
||||
submitButton.disabled = true;
|
||||
loader.style.display = "block";
|
||||
|
||||
try {
|
||||
|
||||
const response =
|
||||
await fetch("/edt.pdf", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type":
|
||||
"application/json"
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body:
|
||||
JSON.stringify({
|
||||
cours
|
||||
})
|
||||
}
|
||||
);
|
||||
body: JSON.stringify({ cours })
|
||||
});
|
||||
|
||||
if (!response.ok)
|
||||
throw new Error("Erreur lors de la génération du PDF.");
|
||||
|
||||
const blob =
|
||||
await response.blob();
|
||||
const blob =
|
||||
await response.blob();
|
||||
|
||||
const url =
|
||||
URL.createObjectURL(blob);
|
||||
|
||||
window.open(
|
||||
URL.createObjectURL(blob)
|
||||
);
|
||||
iframe.src = url;
|
||||
iframe.style.display = "block";
|
||||
|
||||
} catch (err) {
|
||||
|
||||
console.error(err);
|
||||
alert(err.message);
|
||||
|
||||
} finally {
|
||||
|
||||
loader.style.display = "none";
|
||||
submitButton.disabled = false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user