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