This is the code
function readNotes(){
return new Promise((resolve, reject) => {
user = firebase.auth().currentUser.uid
ref = database.ref("users/" + user + "/notes")
ref.get().then( function(snapshot) {
if (snapshot.exists()) {
keys= Object.keys(snapshot.val())
console.log(keys)
resolve(keys);
} else {
console.log("No data available");
}
}).catch((error) => {
reject(error);
})
})
}type here
I tried calling the function in the console and I was expecting for it to return a fulfilled promise, especially because I was able to log the value of the keys variable