ui: Fix errors after migration

This commit is contained in:
nemunaire 2022-10-24 10:36:38 +02:00
commit d791e74a2a
10 changed files with 110 additions and 96 deletions

View file

@ -28,22 +28,24 @@ function createTeamsStore() {
}
}
async function refreshFunc(cb=null, interval=null) {
if (refresh_interval_teams)
clearInterval(refresh_interval_teams);
if (interval === null) {
interval = Math.floor(Math.random() * 24000) + 32000;
}
if (stop_refresh) {
return;
}
refresh_interval_teams = setInterval(refreshFunc, interval);
updateFunc(await fetch('teams.json', {headers: {'Accept': 'application/json'}}), cb);
}
return {
subscribe,
refresh: async (cb=null, interval=null) => {
if (refresh_interval_teams)
clearInterval(refresh_interval_teams);
if (interval === null) {
interval = Math.floor(Math.random() * 24000) + 32000;
}
if (stop_refresh) {
return;
}
refresh_interval_teams = setInterval(refresh_teams, interval);
updateFunc(await fetch('teams.json', {headers: {'Accept': 'application/json'}}), cb);
},
refresh: refreshFunc,
update: updateFunc,
};