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">
|
||||
import { arrayPadEnd } from '$lib/array';
|
||||
import Room from '$lib/Room.svelte';
|
||||
import axios from 'axios';
|
||||
import type { PageData } from './$types';
|
||||
|
||||
let props: { data: PageData } = $props();
|
||||
|
||||
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) =>
|
||||
arrayPadEnd(archivedRoom.players, 4, {
|
||||
name: 'CPU',
|
||||
battleRank: 0,
|
||||
rating: 0
|
||||
})
|
||||
)
|
||||
);
|
||||
</script>
|
||||
|
||||
@ -28,11 +20,8 @@
|
||||
<section>
|
||||
<h1 class="text-4xl font-bold">yukiotoko webui</h1>
|
||||
<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>
|
||||
<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 class="flex flex-col gap-8">
|
||||
|
Loading…
Reference in New Issue
Block a user