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:
parent
0634e5b536
commit
6dc56e02bd
1 changed files with 4 additions and 3 deletions
|
@ -1,7 +1,7 @@
|
||||||
import "../scss/frontend.scss";
|
import "../scss/frontend.scss";
|
||||||
import "../css/userarea.css";
|
import "../css/userarea.css";
|
||||||
|
|
||||||
import { getCookie } from "./api";
|
import { getCookie, getElementById } from "./api";
|
||||||
|
|
||||||
import { Tab } from "bootstrap";
|
import { Tab } from "bootstrap";
|
||||||
import DataTable from "datatables.net-dt";
|
import DataTable from "datatables.net-dt";
|
||||||
|
@ -129,10 +129,11 @@ function uploadFile(file, progressBar, thumbnail) {
|
||||||
xhr.onload = () => {
|
xhr.onload = () => {
|
||||||
if (xhr.status === 201) {
|
if (xhr.status === 201) {
|
||||||
const response = JSON.parse(xhr.responseText);
|
const response = JSON.parse(xhr.responseText);
|
||||||
const thumbnailUrl = response.thumbnailUrl;
|
|
||||||
thumbnail.src = thumbnailUrl;
|
|
||||||
progressBar.classList.add("bg-success");
|
progressBar.classList.add("bg-success");
|
||||||
progressBar.textContent = "Success!";
|
progressBar.textContent = "Success!";
|
||||||
|
|
||||||
|
// TODO: Check API until the first resolution is available
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
progressBar.classList.add("bg-danger");
|
progressBar.classList.add("bg-danger");
|
||||||
progressBar.textContent = "Error!";
|
progressBar.textContent = "Error!";
|
||||||
|
|
Loading…
Reference in a new issue