[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:
parent
538e78f135
commit
c423d7d9df
17 changed files with 314 additions and 194 deletions
|
|
@ -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) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue