When using my application, the process involves uploading a series of images in order to retrieve the file IDs from the system. Once these IDs are obtained, the object can then be uploaded.
async uploadFiles(token: string):Promise<number[]> {
let ids = Array<number>();
this.images.forEach((image: ImageData) => {
this.fileService.uploadFile(image, token).subscribe((result: File) => {
ids.push(result.data.id);
})
});
return ids;
}
The main objective of this function is to collect and return all the IDs. However, due to the nature of the fileService subscribe method, it currently only returns an empty array.