From 6308aa5c9a67cecb48dad3aa35b17ff988fa0068 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90?= Date: Sun, 8 Jan 2023 16:27:38 +0800 Subject: [PATCH] refactor: use paginator for explore --- components/tag/TagCardPaginator.vue | 22 +++++++++++++ components/timeline/TimelineList.vue | 13 -------- pages/[[server]]/explore/tags.vue | 30 +++--------------- pages/[[server]]/explore/users.vue | 46 ++++++++++------------------ 4 files changed, 43 insertions(+), 68 deletions(-) create mode 100644 components/tag/TagCardPaginator.vue delete mode 100644 components/timeline/TimelineList.vue diff --git a/components/tag/TagCardPaginator.vue b/components/tag/TagCardPaginator.vue new file mode 100644 index 000000000..498ff92a9 --- /dev/null +++ b/components/tag/TagCardPaginator.vue @@ -0,0 +1,22 @@ + + + diff --git a/components/timeline/TimelineList.vue b/components/timeline/TimelineList.vue deleted file mode 100644 index 36b364734..000000000 --- a/components/timeline/TimelineList.vue +++ /dev/null @@ -1,13 +0,0 @@ - - - diff --git a/pages/[[server]]/explore/tags.vue b/pages/[[server]]/explore/tags.vue index e687e3bee..f69447f50 100644 --- a/pages/[[server]]/explore/tags.vue +++ b/pages/[[server]]/explore/tags.vue @@ -4,10 +4,9 @@ import { STORAGE_KEY_HIDE_EXPLORE_TAGS_TIPS } from '~~/constants' const { t } = useI18n() const masto = useMasto() -const { data, pending, error } = useLazyAsyncData( - async () => masto.v1.trends.listTags({ limit: 20 }), - { immediate: true }, -) +const paginator = masto.v1.trends.listTags({ + limit: 20, +}) const hideTagsTips = useLocalStorage(STORAGE_KEY_HIDE_EXPLORE_TAGS_TIPS, false) @@ -17,28 +16,9 @@ useHeadFixed({ diff --git a/pages/[[server]]/explore/users.vue b/pages/[[server]]/explore/users.vue index 8d0ed9c63..218d5964e 100644 --- a/pages/[[server]]/explore/users.vue +++ b/pages/[[server]]/explore/users.vue @@ -2,11 +2,7 @@ const { t } = useI18n() // limit: 20 is the default configuration of the official client -const masto = useMasto() -const { data, pending, error } = useLazyAsyncData( - async () => masto.v2.suggestions.list({ limit: 20 }), - { immediate: true }, -) +const paginator = useMasto().v2.suggestions.list({ limit: 20 }) useHeadFixed({ title: () => `${t('tab.for_you')} | ${t('nav.explore')}`, @@ -14,29 +10,19 @@ useHeadFixed({