fix: user 404

This commit is contained in:
三咲智子 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">
const props = defineProps<{
modelValue?: boolean
}>()
const params = useRoute().params
const accountName = $computed(() => params.account as string)
const account = await fetchAccountByName(accountName)
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)
})
const account = await fetchAccountByName(accountName).catch(() => null)
</script>
<template>
@ -25,7 +13,7 @@ const paginator = $computed(() => {
</template>
<CommonNotFound v-else>
Account @{{ params.user }} not found
Account @{{ accountName }} not found
</CommonNotFound>
</MainContent>
</template>

View file

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