<form onSubmit={handleSubmit(signInWithEmail)}>
.....
<Form.Group>
<Button className="btn btn-primary w-100 nextButton" type="submit">
Submit
</Button>
</Form.Group>
</form>
const { data, error } = useCollection(
'adminUsers',
{ listen: true },
{
shouldRetryOnError: true,
}
)
useEffect(() => {
if (data) {
setList(data)
}
}, [data])
const signInWithEmail = async (dataSet: any) => {
try {
const { user } = await fuego
.auth()
.signInWithEmailAndPassword(dataSet.userName, dataSet.password)
let count = 0
// Here I need to call useCollection()...etc
enter code here
for (const employee of list) {
if (employee.userId === user.uid) {
count = count + 1
router.push('myDashboard')
}
}
} catch (e) {
console.log(e?.code)
}
}
在这里我需要调用 useCollection('adminUsers') ...etc 因为我的firebase规则发生了变化,认证后只允许用户获取任何收集数据。目前我在身份验证之前收集了管理员的相关信息。所以我没有得到管理员的相关收集数据。任何关于如何在 signInWithEmail 方法上获取收集数据的建议。谢谢你。