mirror of
https://github.com/System-End/YSWS-Catalog.git
synced 2026-04-19 19:55:07 +00:00
ensured everything was loaded before beginging renderprograms
This commit is contained in:
parent
9b76129a51
commit
b8d8ca20c9
1 changed files with 6 additions and 2 deletions
|
|
@ -2,6 +2,12 @@ let programs = {};
|
|||
const apiUrl = "https://api2.hackclub.com/v0.1/Unified%20YSWS%20Projects%20DB/YSWS%20Programs?cache=true";
|
||||
var participants = []
|
||||
|
||||
async function startRender() {
|
||||
await Promise.all([loadParticipants(), loadPrograms()]);
|
||||
renderPrograms();
|
||||
}
|
||||
startRender()
|
||||
|
||||
function loadParticipants() {
|
||||
fetch(apiUrl).then(response => {
|
||||
if (!response.ok) {
|
||||
|
|
@ -74,8 +80,6 @@ async function loadPrograms() {
|
|||
programs = Object.fromEntries(
|
||||
Object.entries(programs).filter(([_, programsList]) => programsList.length > 0)
|
||||
);
|
||||
|
||||
renderPrograms();
|
||||
} catch (error) {
|
||||
console.error('Error loading programs:', error);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue