2024-02-12 23:05:22 +00:00
|
|
|
document.getElementById("upload-form").addEventListener("submit", event => {
|
2024-02-12 23:07:28 +00:00
|
|
|
event.preventDefault();
|
|
|
|
|
|
|
|
const data = new FormData(event.target);
|
|
|
|
|
2024-02-12 23:05:22 +00:00
|
|
|
fetch("/api/upload-video", {
|
2024-02-12 23:07:28 +00:00
|
|
|
method: "POST",
|
|
|
|
body: data,
|
2024-02-12 23:05:22 +00:00
|
|
|
})
|
|
|
|
.then(response => response.json())
|
|
|
|
.then(response => {
|
|
|
|
if (!response.ok) {
|
|
|
|
error(response.error);
|
|
|
|
return;
|
|
|
|
}
|
2024-02-12 23:07:28 +00:00
|
|
|
|
2024-02-12 23:05:22 +00:00
|
|
|
location.href = "/queue";
|
|
|
|
})
|
|
|
|
.catch(err => {
|
|
|
|
error("failed to upload video");
|
|
|
|
});
|
2024-02-12 23:07:28 +00:00
|
|
|
});
|