我要删除Web应用程序中的帐户,然后仅在没有错误且确实删除了帐户的情况下才重定向到主页。但是,即使firestore中的集合名称不正确,“ react-redux-firebase”库也会解析。
试图在https://github.com/prescottprue/redux-firestore上找到方法firestore.delete()后面的代码,但没有成功
onDeleteClick = () => {
const { selectedClient, firestore } = this.props;
let action = window.confirm(
`Are you sure you want to delete ${selectedClient.firstName} ${
selectedClient.lastName
}?`
);
if (action) {
firestore
.delete({
collection: "clie1112312123nts",
doc: selectedClient.id
})
.then(() => {
console.log("Account Deleted");
this.props.history.push("/");
})
.catch(err => console.log(err));
}
};