Use Interval to refresh data

This commit is contained in:
2025-10-11 23:47:22 +02:00
parent 9668eccfe1
commit acf6039db5

View File

@@ -1,9 +1,7 @@
<template> <template>
<UPageBody class="p-4 flex flex-row flex-wrap gap-6 mt-0"> <UPageBody class="p-4 flex flex-row flex-wrap gap-6 mt-0">
<USkeleton v-if="status !== 'success'" class="w-[240px] h-[350px]" />
<MangaCard <MangaCard
v-for="(m, i) in manga" v-for="(m, i) in manga"
v-else
:key="m.key" :key="m.key"
:manga="m" :manga="m"
:expanded="i === expanded" :expanded="i === expanded"
@@ -16,6 +14,8 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
const { data: manga, status } = await useApi('/v2/Manga', { key: FetchKeys.Manga.All, lazy: true }); const { data: manga, refresh } = await useApi('/v2/Manga', { key: FetchKeys.Manga.All, lazy: true });
onMounted(() => setInterval(refresh, 4000))
const expanded = ref(-1); const expanded = ref(-1);
</script> </script>