I'm using this module to read a value in a Firebase Realtime DB node for an ongoing login.
Here is a code snippet:
const tryGetAuthStatus = (user) =>
new Promise((resolve, reject) => {
var login_node = user.child(provider)
if (login_node.exists()) {
resolve(login_node.val().status)
}
})
ref.child(uuid).once('value') // Returns a promise
.then((user) =>
intervalPromise(
async (iteration, stop) => await tryGetAuthStatus(user), // Returns a promise
attempts_pause,
{iterations: attempts_max, stopOnError: true}
)
)
.then((result) => console.log(result)) // undefined
As you can see I'm returning the interval to continue the promise chain. When firebaseTryGetAuth resolves, it returns the correct result (e.g. "authorized"), but the last 'then' in the chain gets no result from the returned intervalPromise. How can I propagate the result?
I'm using this module to read a value in a Firebase Realtime DB node for an ongoing login.
Here is a code snippet:
As you can see I'm returning the interval to continue the promise chain. When firebaseTryGetAuth resolves, it returns the correct result (e.g. "authorized"), but the last 'then' in the chain gets no result from the returned intervalPromise. How can I propagate the result?