javascript - 如何将用户数据写入 Firebase 实时数据库?
问题描述
我不知道如何将用户输入的数据写入他在数据库中的特定文件夹中。
我想我应该从这样描述一个动作创建者开始:
export const updateUser = values => {
const userId = AsyncStorage.getItem("userId");
fetch(`https://sample-app.firebaseio.com/users/${userId}.json`,
{
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: {
...values
}
})
}
但我的数据库规则设置为:
{
"rules": {
"users": {
"$uid": {
".read": "$uid === auth.uid",
".write": "$uid === auth.uid"
}
}
}
}
所以我不能将任何东西存储到数据库中
我究竟做错了什么?
解决方案
推荐阅读
- rust - 函数参数中的可变借用
- python - 大熊猫的长度不匹配
- python - 如何在 Pytorch 数据集上应用 OpenCV 过滤器?
- java - 使用 Java 录制扬声器输出
- python-3.x - 熊猫检查两个值是否在统计上不同
- c++ - 检查树是否为 bst 但发生错误。失败案例 #25/36:未知信号 11
- python - 在 Python 中对数据框进行排序
- reactjs - 盖茨比中的 children 变量是什么?我怎么能把它分配给另一个组件?
- docusignapi - Docusign API:使用自定义字段搜索给定的信封/信封
- python - DenseFeatures 层可以定义 input_shape 吗?