fix: user 404

zio/stable
三咲智子 2022-11-25 17:50:49 +08:00
parent 3dddf6d5f7
commit 3c550b832b
No known key found for this signature in database
GPG Key ID: 69992F2250DFD93E
2 changed files with 5 additions and 21 deletions

View File

@ -1,20 +1,8 @@
<script setup lang="ts"> <script setup lang="ts">
const props = defineProps<{
modelValue?: boolean
}>()
const params = useRoute().params const params = useRoute().params
const accountName = $computed(() => params.account as string) const accountName = $computed(() => params.account as string)
const account = await fetchAccountByName(accountName) const account = await fetchAccountByName(accountName).catch(() => null)
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 paginator = $computed(() => {
return masto.accounts.getStatusesIterable(account.id, { excludeReplies: tab === 'Posts' } as any)
})
</script> </script>
<template> <template>
@ -25,7 +13,7 @@ const paginator = $computed(() => {
</template> </template>
<CommonNotFound v-else> <CommonNotFound v-else>
Account @{{ params.user }} not found Account @{{ accountName }} not found
</CommonNotFound> </CommonNotFound>
</MainContent> </MainContent>
</template> </template>

View File

@ -1,8 +1,4 @@
<script setup lang="ts"> <script setup lang="ts">
const props = defineProps<{
modelValue?: boolean
}>()
const params = useRoute().params const params = useRoute().params
const accountName = $computed(() => params.account as string) const accountName = $computed(() => params.account as string)
@ -12,11 +8,11 @@ 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. // 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 tab = $ref('Posts')
const paginator1 = masto.accounts.getStatusesIterable(account.id, { excludeReplies: true }) const paginatorPosts = masto.accounts.getStatusesIterable(account.id, { excludeReplies: true })
const paginator2 = masto.accounts.getStatusesIterable(account.id, { excludeReplies: false }) const paginatorPostsWithReply = masto.accounts.getStatusesIterable(account.id, { excludeReplies: false })
const paginator = $computed(() => { const paginator = $computed(() => {
return tab === 'Posts' ? paginator1 : paginator2 return tab === 'Posts' ? paginatorPosts : paginatorPostsWithReply
}) })
</script> </script>