refactor: inject masto instance via nuxt app (#134)
This commit is contained in:
parent
5c60497421
commit
39b005899e
26 changed files with 67 additions and 48 deletions
|
@ -3,7 +3,7 @@ const params = useRoute().params
|
|||
const accountName = $computed(() => params.account as string)
|
||||
|
||||
const account = await fetchAccountByName(accountName)
|
||||
const paginator = account ? masto.accounts.getFollowersIterable(account.id, {}) : null
|
||||
const paginator = account ? useMasto().accounts.getFollowersIterable(account.id, {}) : null
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
|
@ -3,7 +3,7 @@ const params = useRoute().params
|
|||
const accountName = $computed(() => params.account as string)
|
||||
|
||||
const account = await fetchAccountByName(accountName)
|
||||
const paginator = account ? masto.accounts.getFollowingIterable(account.id, {}) : null
|
||||
const paginator = account ? useMasto().accounts.getFollowingIterable(account.id, {}) : null
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
|
@ -8,8 +8,8 @@ const tabNames = ['Posts', 'Posts and replies'] as const
|
|||
// Don't use local storage because it is better to default to Posts every time you visit a user's profile.
|
||||
const tab = $ref('Posts')
|
||||
|
||||
const paginatorPosts = masto.accounts.getStatusesIterable(account.id, { excludeReplies: true })
|
||||
const paginatorPostsWithReply = masto.accounts.getStatusesIterable(account.id, { excludeReplies: false })
|
||||
const paginatorPosts = useMasto().accounts.getStatusesIterable(account.id, { excludeReplies: true })
|
||||
const paginatorPostsWithReply = useMasto().accounts.getStatusesIterable(account.id, { excludeReplies: false })
|
||||
|
||||
const paginator = $computed(() => {
|
||||
return tab === 'Posts' ? paginatorPosts : paginatorPostsWithReply
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue