+select category/surfer
This commit is contained in:
parent
317fac17b2
commit
35b24c95e1
2 changed files with 24 additions and 9 deletions
|
@ -50,7 +50,7 @@
|
|||
const data = await res.json();
|
||||
for (let i in data) {
|
||||
heats[i] = data[i];
|
||||
console.log(`${i} retval: ${JSON.stringify(data[i])}`);
|
||||
console.log(`${i} loadHeats: ${JSON.stringify(data[i])}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,20 +62,26 @@
|
|||
'Content-Type': 'application/json'
|
||||
}
|
||||
});
|
||||
console.log(`retval: ${JSON.stringify(res)}`);
|
||||
console.log(`deleteHeat: ${JSON.stringify(res)}`);
|
||||
|
||||
console.log(JSON.stringify(heats[id]));
|
||||
resetHeat();
|
||||
loadHeats();
|
||||
}
|
||||
|
||||
async function loadSurfers() {
|
||||
async function loadSurfers(category) {
|
||||
athletes = [];
|
||||
console.log(`load surfer`);
|
||||
const res = await fetch(`/api/loadsurfers`);
|
||||
const data = await res.json();
|
||||
for (let i in data) {
|
||||
athletes[i] = data[i];
|
||||
console.log(`${i} retval: ${JSON.stringify(data[i])}`);
|
||||
if (data[i].category === category) {
|
||||
athletes.push(data[i]);
|
||||
console.log(`${i} loadSurfers: ${JSON.stringify(data[i])}`);
|
||||
}
|
||||
}
|
||||
athletes = athletes;
|
||||
console.log(`category: ${JSON.stringify(athletes)}`);
|
||||
}
|
||||
|
||||
function setHeat(id) {
|
||||
|
@ -149,7 +155,7 @@
|
|||
'Content-Type': 'application/json'
|
||||
}
|
||||
});
|
||||
console.log(`retval: ${JSON.stringify(res)}`);
|
||||
console.log(`save: ${JSON.stringify(res)}`);
|
||||
|
||||
console.log(JSON.stringify(heat));
|
||||
|
||||
|
@ -197,7 +203,7 @@
|
|||
id="category"
|
||||
options={$categories}
|
||||
bind:value={heat.category}
|
||||
handleSelect={loadSurfers}
|
||||
handleSelect={loadSurfers(heat.category)}
|
||||
/>
|
||||
</div>
|
||||
<div class="duration">
|
||||
|
@ -219,6 +225,7 @@
|
|||
id="name{surfer}"
|
||||
bind:value={surfer_list[surfer].name}
|
||||
options={athletes}
|
||||
element="firstname"
|
||||
/>
|
||||
<!-- <Input label="Name" id="name{surfer}" bind:value={surfer_list[surfer].name} /> -->
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue