The following code will store an object with au automatically generated name. Instead, I want to be able to specify that name in advance. How would I go about that? Thanks
const request = new Request('firebaseUsr.json',{
method:'POST',
headers:{
name:formState.inputValues.username,
},
body:JSON.stringify({
username,
password
})
})
fetch(request)
.then(response => {
if (response.status === 200) {
return response.json();
} else {
throw new Error('Something went wrong on api server!');
}
})
.then(response => {
console.debug(response);
// ...
}).catch(error => {
console.error(error);
});