I want to return the snapshot.val()
, of my Realtime Database:
function get_details(){
get(ref(db,"pay/0/0/")).then((snapshot) => {
if (snapshot.exists()) {
var resp = [];
resp.push(snapshot.val());
return resp;
}
}
}
let response = get_details();
console.log(response); //undefined
I keep getting undefined
as the returned value. I have followed the answer from this post.
How do I resolve this issue?