[WEB-2717] chore: implemented issue attachment upload progress (#5901)

* chore: added attachment upload progress

* chore: add debounce while updating the upload status

* chore: update percentage calc logic

* chore: update debounce interval
This commit is contained in:
Aaryan Khandelwal 2024-10-29 19:22:29 +05:30 committed by GitHub
parent 538e78f135
commit c423d7d9df
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 314 additions and 194 deletions

View file

@ -1,4 +1,4 @@
import axios from "axios";
import axios, { AxiosRequestConfig } from "axios";
// services
import { APIService } from "@/services/api.service";
@ -9,7 +9,11 @@ export class FileUploadService extends APIService {
super("");
}
async uploadFile(url: string, data: FormData): Promise<void> {
async uploadFile(
url: string,
data: FormData,
uploadProgressHandler?: AxiosRequestConfig["onUploadProgress"]
): Promise<void> {
this.cancelSource = axios.CancelToken.source();
return this.post(url, data, {
headers: {
@ -17,6 +21,7 @@ export class FileUploadService extends APIService {
},
cancelToken: this.cancelSource.token,
withCredentials: false,
onUploadProgress: uploadProgressHandler,
})
.then((response) => response?.data)
.catch((error) => {