Distribute and handle challenge.json

This commit is contained in:
nemunaire 2022-05-01 22:33:59 +02:00
commit dff4f4eb63
20 changed files with 167 additions and 48 deletions

View file

@ -1,4 +1,5 @@
<script context="module">
import { challengeInfo } from '../stores/challengeinfo.js';
import { issuesStore } from '../stores/issues.js';
import { my } from '../stores/my.js';
import { teamsStore } from '../stores/teams.js';
@ -41,6 +42,10 @@
settings.update(await fetch('settings.json', {headers: {'Accept': 'application/json'}}), cb);
}
async function refresh_challengeInfo(cb=null) {
challengeInfo.update(await fetch('challenge.json', {headers: {'Accept': 'application/json'}}), cb);
}
let refresh_interval_teams = null;
async function refresh_teams(cb=null, interval=null) {
if (refresh_interval_teams)
@ -102,6 +107,7 @@
}
export async function load({ stuff }) {
await refresh_challengeInfo();
await refresh_settings();
await refresh_themes();
refresh_teams();
@ -115,6 +121,7 @@
return {
stuff: {
...stuff,
refresh_challengeInfo,
refresh_settings,
refresh_teams,
refresh_themes,
@ -138,7 +145,8 @@
</script>
<svelte:head>
<title>{$settings.title}</title>
<title>{$challengeInfo.title}</title>
<meta name="author" content="{$challengeInfo.authors}">
</svelte:head>
<!--Styles /-->