summaryrefslogtreecommitdiff
path: root/packages/frontend/src/pages/follow-requests.vue
diff options
context:
space:
mode:
authorsyuilo <4439005+syuilo@users.noreply.github.com>2025-06-29 15:11:25 +0900
committersyuilo <4439005+syuilo@users.noreply.github.com>2025-06-29 15:11:25 +0900
commitf1deb89e348eb8f1a39b51e33a0ae33d59529feb (patch)
tree2e92a7a21a1bf377719e1b125a9ac44bc14a529e /packages/frontend/src/pages/follow-requests.vue
parentfeat(backend): クリップ内でノートを検索できるように (diff)
downloadmisskey-f1deb89e348eb8f1a39b51e33a0ae33d59529feb.tar.gz
misskey-f1deb89e348eb8f1a39b51e33a0ae33d59529feb.tar.bz2
misskey-f1deb89e348eb8f1a39b51e33a0ae33d59529feb.zip
refactor(frontend): improve pagination implementation
Diffstat (limited to 'packages/frontend/src/pages/follow-requests.vue')
-rw-r--r--packages/frontend/src/pages/follow-requests.vue34
1 files changed, 17 insertions, 17 deletions
diff --git a/packages/frontend/src/pages/follow-requests.vue b/packages/frontend/src/pages/follow-requests.vue
index e02abdc393..35e259a571 100644
--- a/packages/frontend/src/pages/follow-requests.vue
+++ b/packages/frontend/src/pages/follow-requests.vue
@@ -5,8 +5,8 @@ SPDX-License-Identifier: AGPL-3.0-only
<template>
<PageWithHeader v-model:tab="tab" :actions="headerActions" :tabs="headerTabs" :swipable="true">
- <div class="_spacer" style="--MI_SPACER-w: 800px;">
- <MkPagination ref="paginationComponent" :pagination="pagination">
+ <div :key="tab" class="_spacer" style="--MI_SPACER-w: 800px;">
+ <MkPagination :paginator="paginator">
<template #empty><MkResult type="empty" :text="i18n.ts.noFollowRequests"/></template>
<template #default="{items}">
<div class="mk-follow-requests _gaps">
@@ -35,8 +35,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import * as Misskey from 'misskey-js';
-import { useTemplateRef, computed, ref } from 'vue';
-import type { PagingCtx } from '@/composables/use-pagination.js';
+import { computed, markRaw, ref, watch } from 'vue';
import MkPagination from '@/components/MkPagination.vue';
import MkButton from '@/components/MkButton.vue';
import { userPage, acct } from '@/filters/user.js';
@@ -44,32 +43,35 @@ import * as os from '@/os.js';
import { i18n } from '@/i18n.js';
import { definePage } from '@/page.js';
import { $i } from '@/i.js';
+import { Paginator } from '@/utility/paginator.js';
-const paginationComponent = useTemplateRef('paginationComponent');
+const tab = ref($i?.isLocked ? 'list' : 'sent');
+
+let paginator: Paginator<'following/requests/list' | 'following/requests/sent'>;
-const pagination = computed<PagingCtx>(() => tab.value === 'list' ? {
- endpoint: 'following/requests/list',
- limit: 10,
-} : {
- endpoint: 'following/requests/sent',
- limit: 10,
-});
+watch(tab, (newTab) => {
+ if (newTab === 'list') {
+ paginator = markRaw(new Paginator('following/requests/list', { limit: 10 }));
+ } else {
+ paginator = markRaw(new Paginator('following/requests/sent', { limit: 10 }));
+ }
+}, { immediate: true });
function accept(user: Misskey.entities.UserLite) {
os.apiWithDialog('following/requests/accept', { userId: user.id }).then(() => {
- paginationComponent.value?.paginator.reload();
+ paginator.reload();
});
}
function reject(user: Misskey.entities.UserLite) {
os.apiWithDialog('following/requests/reject', { userId: user.id }).then(() => {
- paginationComponent.value?.paginator.reload();
+ paginator.reload();
});
}
function cancel(user: Misskey.entities.UserLite) {
os.apiWithDialog('following/requests/cancel', { userId: user.id }).then(() => {
- paginationComponent.value?.paginator.reload();
+ paginator.reload();
});
}
@@ -91,8 +93,6 @@ const headerTabs = computed(() => [
},
]);
-const tab = ref($i?.isLocked ? 'list' : 'sent');
-
definePage(() => ({
title: i18n.ts.followRequests,
icon: 'ti ti-user-plus',