Updating Data In Firebase Using React And Axios
I'm trying to update some data in a firebase database. However i am unable to get the updateAPI function to work properly. I believe it's something to do with axios.put, the url is
Solution 1:
Try:
async updateAPI(){
const response = await axios.put('https://fir-test-euifhefibewif.firebaseio.com/todos/-LVYEw6KTltVoEkPeuxY/name/0', note)
console.log(response)
console.log(response.data)
}
// Test data
const note = {
name: 'Test',
race: 'Test'
}
To write to Firebase Database using REST, the URL must end in .json. So:
url = yourUrl + ".json";
Find more information here: https://firebase.google.com/docs/database/rest/save-data
Post a Comment for "Updating Data In Firebase Using React And Axios"