有什么方法可以从reactJS的firebase的上传中获取URL,然后将其插入带有URL标记的我的client对象中?
handleUploadSuccess = filename => {
this.setState({ avatar: filename, progress: 100, isUploading: false });
firebase
.storage()
.ref("images")
.child(filename)
.getDownloadURL()
.then(url => this.setState({ avatarURL: url } ))
.then(function(snapshot)
{
const url = snapshot.getDownloadURL();
const clientRef = firebase.database().ref('clients');
const clientsData = {
companyName: this.companyName.value,
ID: this.state.ID,
URL: url
}
});
};