Fetch until ok
This commit is contained in:
@ -1,8 +1,19 @@
|
||||
let build_id = "";
|
||||
|
||||
async function fetch_until_ok(uri)
|
||||
{
|
||||
while (true) {
|
||||
try {
|
||||
return await fetch(uri);
|
||||
} catch {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function fetch_build_id()
|
||||
{
|
||||
const response = await fetch("/build-id");
|
||||
const response = await fetch_until_ok("/build-id");
|
||||
const json = await response.json();
|
||||
return json.build_id;
|
||||
}
|
||||
|
Reference in New Issue
Block a user