mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-11-23 09:45:46 +03:00
Followed hashtags are paginated
Gotta fetch 'em all! I don't know the limit, but let's fetch ALL for now instead of lazy loaded.
This commit is contained in:
parent
a6f300d4af
commit
6f242aad27
1 changed files with 12 additions and 2 deletions
|
@ -7,6 +7,8 @@ import Menu from '../components/menu';
|
|||
import { api } from '../utils/api';
|
||||
import useTitle from '../utils/useTitle';
|
||||
|
||||
const LIMIT = 200;
|
||||
|
||||
function FollowedHashtags() {
|
||||
const { masto, instance } = api();
|
||||
useTitle(`Followed Hashtags`, `/ft`);
|
||||
|
@ -17,7 +19,15 @@ function FollowedHashtags() {
|
|||
setUiState('loading');
|
||||
(async () => {
|
||||
try {
|
||||
const tags = await masto.v1.followedTags.list();
|
||||
const iterator = masto.v1.followedTags.list({
|
||||
limit: LIMIT,
|
||||
});
|
||||
const tags = [];
|
||||
do {
|
||||
const { value, done } = await iterator.next();
|
||||
if (done || value?.length === 0) break;
|
||||
tags.push(...value);
|
||||
} while (true);
|
||||
console.log(tags);
|
||||
setFollowedHashtags(tags);
|
||||
setUiState('default');
|
||||
|
@ -60,7 +70,7 @@ function FollowedHashtags() {
|
|||
</ul>
|
||||
) : uiState === 'loading' ? (
|
||||
<p class="ui-state">
|
||||
<Loader />
|
||||
<Loader abrupt />
|
||||
</p>
|
||||
) : uiState === 'error' ? (
|
||||
<p class="ui-state">Unable to load followed hashtags.</p>
|
||||
|
|
Loading…
Reference in a new issue