This is most likely because I am not familiar enough with promises... but, how can I pass a function in a variable and then retry it if it fails the first time?:
// works ok:
await retry(
async (bail) => {
const res = await fetch('https://google.com')
}
);
// does not work
const Fn = fetch('https://google.com')
await retry(
async (bail) => {
const res = await Fn; // if fails first time, it is not called again
}
);
This is most likely because I am not familiar enough with promises... but, how can I pass a function in a variable and then retry it if it fails the first time?: