feat(userarea.js): enhance file upload feedback

Enhanced the file upload feedback mechanism in `userarea.js` by
introducing a clearer, success indication and preparing for future
implementations where upload completion will trigger additional checks
against the API for resolution availability. This change brings a more
intuitive user experience during file uploads and lays groundwork for
next steps in upload handling, ensuring users are better informed of the
upload status in real-time.

- Imported `getElementById` for future feature expansion.
- Added a TODO comment as a placeholder for upcoming API check
functionality.
This commit is contained in:
Kumi 2024-03-16 21:57:25 +01:00
parent 0634e5b536
commit 6dc56e02bd
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -1,7 +1,7 @@
import "../scss/frontend.scss";
import "../css/userarea.css";
import { getCookie } from "./api";
import { getCookie, getElementById } from "./api";
import { Tab } from "bootstrap";
import DataTable from "datatables.net-dt";
@ -129,10 +129,11 @@ function uploadFile(file, progressBar, thumbnail) {
xhr.onload = () => {
if (xhr.status === 201) {
const response = JSON.parse(xhr.responseText);
const thumbnailUrl = response.thumbnailUrl;
thumbnail.src = thumbnailUrl;
progressBar.classList.add("bg-success");
progressBar.textContent = "Success!";
// TODO: Check API until the first resolution is available
} else {
progressBar.classList.add("bg-danger");
progressBar.textContent = "Error!";