fix: remove refresh button
svelte is doing some weird reactivity stuff when you use this lool
This commit is contained in:
parent
ee79599978
commit
bab359c212
@ -1,26 +1,18 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { arrayPadEnd } from '$lib/array';
|
import { arrayPadEnd } from '$lib/array';
|
||||||
import Room from '$lib/Room.svelte';
|
import Room from '$lib/Room.svelte';
|
||||||
import axios from 'axios';
|
|
||||||
import type { PageData } from './$types';
|
import type { PageData } from './$types';
|
||||||
|
|
||||||
let props: { data: PageData } = $props();
|
let props: { data: PageData } = $props();
|
||||||
|
|
||||||
let data = $state(props.data);
|
let data = $state(props.data);
|
||||||
let refreshTimer = $state(60);
|
|
||||||
|
|
||||||
async function refresh() {
|
|
||||||
data = await axios.get('/api/data').then((result) => result.data);
|
|
||||||
}
|
|
||||||
|
|
||||||
$effect(() =>
|
|
||||||
data.archivedRooms.forEach((archivedRoom) =>
|
data.archivedRooms.forEach((archivedRoom) =>
|
||||||
arrayPadEnd(archivedRoom.players, 4, {
|
arrayPadEnd(archivedRoom.players, 4, {
|
||||||
name: 'CPU',
|
name: 'CPU',
|
||||||
battleRank: 0,
|
battleRank: 0,
|
||||||
rating: 0
|
rating: 0
|
||||||
})
|
})
|
||||||
)
|
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -28,11 +20,8 @@
|
|||||||
<section>
|
<section>
|
||||||
<h1 class="text-4xl font-bold">yukiotoko webui</h1>
|
<h1 class="text-4xl font-bold">yukiotoko webui</h1>
|
||||||
<p>a frontend redesign for <a href="http://yukiotoko.chara.lol/">yukiotoko</a></p>
|
<p>a frontend redesign for <a href="http://yukiotoko.chara.lol/">yukiotoko</a></p>
|
||||||
|
<p class="text-sub">refresh the page to fetch newer yukiotoko data</p>
|
||||||
</section>
|
</section>
|
||||||
<div>
|
|
||||||
<button class="bg-accent rounded-lg px-3 py-2" onclick={refresh}>Refresh</button>
|
|
||||||
<p class="text-sub">load the current data from yukiotoko</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-col gap-8">
|
<div class="flex flex-col gap-8">
|
||||||
|
Loading…
Reference in New Issue
Block a user