我有从数据链接数组上传文件的功能
我想做的是如果数据链接数组包含 3 个文件
const testLinks = 3;并且async uploadImageData被解雇了三次我想在被解雇了三次console.log之后。uploadImageData
我正在考虑进行计数,但我所有的测试都会在每次被触发时重新开始计数uploadImageData。
.ts
async uploadImageData(formData: FormData) {
const testLinks = 3;
const uploadlink = answerAtachmentUrl;
const headers = headerLink;
const loading = await this.loadingController.create({
message: 'Uploading Photos and Files...',
});
await loading.present();
this.httpClient.post<any>( uploadlink + this.userToken, formData,
{ 'headers':headers }
).pipe(
finalize(() => { loading.dismiss();})
)
.subscribe(res => {
if (res['success']) {
setTimeout(() => { this.DeleteAllFiles(); }, 5000);
this.presentToastPhoto('Photo sync success.');
} else {
this.presentToastPhoto('Photo upload failed.');
let respFail = JSON.stringify(res);
console.log("respFail", respFail);
}
});
// console.log fires once after count and const testLinks both equal 3
}
侃侃尔雅
相关分类