【发布时间】:2018-06-04 09:31:52
【问题描述】:
当用户想要删除他的帐户时,我想确保他在 Firebase 中创建的“文档”也被删除。
我在网上找到了一些帮助:
deleteAccount() {
const qry: firebase.firestore.QuerySnapshot = await this.afs.collection('houses', ref => ref.where('email', '==', this.afAuth.auth.currentUser.email)).ref.get();
const batch = this.afs.firestore.batch();
qry.forEach( doc => {
batch.delete(doc.ref);
});
batch.commit();
}
但我在“等待”关键字上收到错误消息:'await' expression is only allowed within an async function.
谁能告诉我如何解决这个问题,或者是否有更好的方法?
我对此很陌生,所以我不确定如何继续,非常感谢任何帮助。
【问题讨论】:
标签: angular typescript firebase google-cloud-firestore