In my Angular app, while uploading a video, first I have to get the signed Url and then I have to do the post call to this signed url, including the video as payload. And I was doing like that:
uploadImage(bucket: BucketTypes, file: File, customUrl?: string): Observable<IUploadedImage> {
const formData = new FormData();
formData.append('file', file);
let params = {
entity: bucket,
fileExtension: file.type
};
this.http.get<IUploadedImage>(
customUrl ? customUrl : assetsUrl.uploadImage(this.baseUrl, bucket),
{params}
).subscribe((response: any)=> {
let url = response.signedUrl;
return this.http.post<IUploadedImage>(url, formData);
});
}
Later on, I want to subscribe to the uploadImage function. But it is not working.
How can I do that? Can someone please explain? What have I done wrong here?