now with dynamic counter too

This commit is contained in:
2025-01-10 18:09:32 -05:00
parent a745239d16
commit 987baf1ad6
8 changed files with 103 additions and 5 deletions

View File

@@ -16,7 +16,7 @@
<div>
<button onclick={loadCard}>Load Card</button>
<button id="nextbtn" onclick={loadCard}>Load Card</button>
{#each cards as card}
<article>

View File

@@ -0,0 +1,23 @@
<script lang="ts">
import { onMount } from 'svelte';
let count = null;
async function loadNext() {
const response = await fetch('http://127.0.0.1:9000/next_json');
count = (await response.json()).count;
}
onMount(() => {
loadNext();
});
</script>
<div>
<button id="nextbtn" onclick={loadNext}>Load Next</button>
{#if count}
<p>Count: {count}</p>
{/if}
</div>