0👍
✅
rewrite getUserId to return a Promise
function getUserId() {
return new Promise((resolve, reject) => {
getAuth().onAuthStateChanged((user) => {
if (user) {
const uid = user.uid;
console.log("1st uid:" + uid);
resolve(uid);
} else {
console.log("sad didnt work.");
reject();
}
});
});
}
Source:stackexchange.com