feat(userarea): handle file upload success more
visibly Improve user feedback during file uploads by explicitly handling HTTP 201 responses as successful uploads. Upon a successful upload, the progress bar now turns green (`bg-success`) and displays a "Success!" message, providing a clearer and more immediate visual cue to the user that their file has been successfully uploaded. This change addresses usability issues by making the upload progress and outcome more discernible to users.
This commit is contained in:
parent
7d78c5d4a0
commit
53d90cb070
1 changed files with 3 additions and 1 deletions
|
@ -117,10 +117,12 @@ function uploadFile(file, progressBar, thumbnail) {
|
||||||
xhr.open('POST', document.location.href, true);
|
xhr.open('POST', document.location.href, true);
|
||||||
|
|
||||||
xhr.onload = () => {
|
xhr.onload = () => {
|
||||||
if (xhr.status === 200) {
|
if (xhr.status === 201) {
|
||||||
const response = JSON.parse(xhr.responseText);
|
const response = JSON.parse(xhr.responseText);
|
||||||
const thumbnailUrl = response.thumbnailUrl;
|
const thumbnailUrl = response.thumbnailUrl;
|
||||||
thumbnail.src = thumbnailUrl;
|
thumbnail.src = thumbnailUrl;
|
||||||
|
progressBar.classList.add('bg-success');
|
||||||
|
progressBar.textContent = "Success!";
|
||||||
} else {
|
} else {
|
||||||
progressBar.classList.add('bg-danger');
|
progressBar.classList.add('bg-danger');
|
||||||
progressBar.textContent = "Error!";
|
progressBar.textContent = "Error!";
|
||||||
|
|
Loading…
Reference in a new issue