I am currently using axios to post/get from my Firebase database in my React application. I had no issue until I attempted to make my first POSTs to the database. It is successfully POSTing, but I am getting a random string for an ID instead of it directly posting into the place in my database I want.
Instead of being preregs -> group -> 2020 -> userID: value as I want it, I'm getting prereg -> random key -> group -> 2020 -> userID: value.
Currently, my POST code reads as:
axios.post('/preregs.json', {
[this.props.group]: {
[this.props.currentYear]: {
[this.props.userID]: document.getElementsByTagName("input")["email"].value
}
}
})
I have heard that if you don't use POST to put data into a Firebase database, it won't create that random ID. However, patch won't work as it just deletes all the data I had within 2020. I looked at other questions posted such as Setting custom key when pushing new data to firebase database, but it is using Firebase to do the work instead of Axios. Also Firebase POST custom ID who seems to have the same issue, with the only answering being to use 'put, but again that erases everything else I have in 2020. Is there something I am missing to stop Firebase from putting this random key when I don't want it to?