feat: add not found for user pages

This commit is contained in:
三咲智子 2022-11-24 01:16:10 +08:00
parent ae6552fee0
commit a473cc2de5
No known key found for this signature in database
GPG key ID: 69992F2250DFD93E
5 changed files with 46 additions and 22 deletions

View file

@ -0,0 +1,8 @@
<template>
<div flex="~ col" items-center>
<div i-ri:forbid-line text-10 mt10 mb2 />
<div text-lg>
<slot>Not found</slot>
</div>
</div>
</template>

View file

@ -29,9 +29,7 @@ const { data: context } = await useAsyncData(`${id}-context`, () => masto.status
</template> </template>
</template> </template>
<template> <CommonNotFound v-else>
<div> Status not found
Status not found </CommonNotFound>
</div>
</template>
</template> </template>

View file

@ -2,13 +2,19 @@
const params = useRoute().params const params = useRoute().params
const user = $computed(() => params.user as string) const user = $computed(() => params.user as string)
const { data: account } = await useAsyncData(`${user}:info`, () => masto.accounts.lookup({ acct: user })) const { data: account } = $(await useAsyncData(`${user}:info`, () => masto.accounts.lookup({ acct: user })))
const paginator = masto.accounts.getFollowersIterable(account.value!.id!, {}) const paginator = account ? masto.accounts.getFollowersIterable(account!.id!, {}) : null
</script> </script>
<template> <template>
<div> <template v-if="account">
<AccountHeader :account="account" /> <div>
</div> <AccountHeader :account="account" />
<AccountPaginator :paginator="paginator" /> </div>
<AccountPaginator :paginator="paginator" />
</template>
<CommonNotFound v-else>
Account @{{ params.user }} not found
</CommonNotFound>
</template> </template>

View file

@ -2,13 +2,19 @@
const params = useRoute().params const params = useRoute().params
const user = $computed(() => params.user as string) const user = $computed(() => params.user as string)
const { data: account } = await useAsyncData(`${user}:info`, () => masto.accounts.lookup({ acct: user })) const { data: account } = $(await useAsyncData(`${user}:info`, () => masto.accounts.lookup({ acct: user })))
const paginator = masto.accounts.getFollowingIterable(account.value!.id!, {}) const paginator = account ? masto.accounts.getFollowingIterable(account!.id!, {}) : null
</script> </script>
<template> <template>
<div> <template v-if="account">
<AccountHeader :account="account" /> <div>
</div> <AccountHeader :account="account" />
<AccountPaginator :paginator="paginator" /> </div>
<AccountPaginator :paginator="paginator" />
</template>
<CommonNotFound v-else>
Account @{{ params.user }} not found
</CommonNotFound>
</template> </template>

View file

@ -19,9 +19,15 @@ const paginator = $computed(() => {
</script> </script>
<template> <template>
<div> <template v-if="account">
<AccountHeader :account="account" /> <div>
</div> <AccountHeader :account="account" />
<CommonTabs v-model="tab" :options="tabNames" /> </div>
<TimelinePaginator :key="tab" :paginator="paginator" /> <CommonTabs v-model="tab" :options="tabNames" />
<TimelinePaginator :key="tab" :paginator="paginator" />
</template>
<CommonNotFound v-else>
Account @{{ params.user }} not found
</CommonNotFound>
</template> </template>