我上传文件后似乎无法获得下载网址

时间:2019-02-26 00:33:53

标签: javascript firebase ionic3 firebase-storage

我似乎无法获取下载URL并使我的imageUrl变量未定义。我很想知道您是否可以指出我做错的地方并纠正我。

recognize(){

const loader = this.loadingCtrl.create({
  content: "Please wait..."
});
loader.present();

let headers = new Headers();

headers.append('Accept', 'application/json');
headers.append('apikey', 'aee073101c4f11e9bba4c5572eb43161');


let formData = new FormData();

formData.append('file', this.myImage);

console.log(this.myImage);

this.http.post('https://api.taggun.io/api/receipt/v1/simple/file', formData, {headers: headers})
.pipe(map(res => res.json()))
  .subscribe(data =>{
    console.log(data);
    this.data = data;
    loader.dismiss();
    // this.data.date.data = moment(this.data.date.data).subtract(10, 'days').calendar();
    this.data.date.data = this.formatdmy(this.data.date.data);
    this.data.image = this.myImage;
    console.log(this.data.image);
    this.upload(this.data.image);
    console.log(this.imageUrl);
    this.saveToDatabase();


  });(err)=> {
    loader.dismiss()
    const toast = this.toastCtrl.create({
      message: 'The Receipt was not scanned',
      duration: 3000
    });
    toast.present();
  };
}

this is my other functions

0 个答案:

没有答案