我正在尝试从Firebase Storage上传文件。如果文件存在,没问题,但是如果文件不存在,则无限期调用该函数。
这是我的代码:
async componentWillMount() {
firebase
.storage()
.ref()
.child(this.props.firebaseUser.uid)
.getDownloadURL()
.then(uri => {
store.dispatch(UpdateUser({ profileImage: uri }));
})
.catch((error) => {
console.log(error)
});
}
}
我还尝试添加一个标志firestoreHasBeenCalled,但是该函数仍被无限期调用。我在做什么错了?