What I'm trying to accomplish here is a simple idea.
Upload file to Firebase Storage
Grab the link to the file and insert it in the form.
Problem is, I can't get the download URL.
When I upload something, it does upload, but I get this error message:
Object { code_: "storage/object-not-found", message_: "Firebase Storage: Object 'rnmgm3vvpz' does not exist.", serverResponse_: "{\n  \"error\": {\n    \"code\": 404,\n    \"message\": \"Not Found.  Could not get object\"\n  }\n}", name_: "FirebaseError" }
And this is the code to upload on component.ts:
upload(event) {
  const id = Math.random().toString(36).substring(2);
  this.ref = this.afStorage.ref(id);
  this.task = this.ref.put(event.target.files[0]);
  this.uploadState = this.task.snapshotChanges().pipe(map(s => s.state));
  this.uploadProgress = this.task.percentageChanges();
  this.downloadURL = this.ref.getDownloadURL();
}
And on component.html:
<input type="file" (change)="upload($event)" accept=".png,.jpg" />
How can I grab the downloadURL after the file is uploaded?