🐛 Fix sphere webpage loading
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
:custom-request="customRequest"
|
||||
v-model:file-list="fileList"
|
||||
>
|
||||
<div class="flex flex-col gap-3">
|
||||
<div class="flex flex-col gap-2">
|
||||
<pub-select v-model:value="publisher" />
|
||||
<n-input
|
||||
type="textarea"
|
||||
@@ -16,7 +16,7 @@
|
||||
@keydown.meta.enter.exact="submit"
|
||||
@keydown.ctrl.enter.exact="submit"
|
||||
/>
|
||||
<n-upload-file-list />
|
||||
<n-upload-file-list v-if="fileList" />
|
||||
<div class="flex justify-between">
|
||||
<div class="flex gap-2">
|
||||
<n-upload-trigger #="{ handleClick }" abstract>
|
||||
|
@@ -57,22 +57,21 @@ onMounted(() => fetchVersion())
|
||||
const loading = ref(false)
|
||||
|
||||
const activites = ref<any[]>([])
|
||||
const activitesLast = computed(
|
||||
() =>
|
||||
activites.value.sort(
|
||||
(a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime(),
|
||||
)[0],
|
||||
)
|
||||
const activitesLast = computed(() => activites.value[Math.max(activites.value.length - 1, 0)])
|
||||
const activitesHasMore = ref(true)
|
||||
|
||||
async function fetchActivites() {
|
||||
if (loading.value) return
|
||||
if (!activitesHasMore.value) return
|
||||
loading.value = true
|
||||
const resp = await fetch(
|
||||
activitesLast.value == null
|
||||
? '/api/activities'
|
||||
: `/api/activities?cursor=${new Date(activitesLast.value.created_at).toISOString()}`,
|
||||
)
|
||||
activites.value.push(...(await resp.json()))
|
||||
const data = await resp.json()
|
||||
activites.value = [...activites.value, ...data]
|
||||
activitesHasMore.value = data[0]?.type != 'empty'
|
||||
loading.value = false
|
||||
}
|
||||
onMounted(() => fetchActivites())
|
||||
|
Reference in New Issue
Block a user