mirror of
https://github.com/elk-zone/elk.git
synced 2024-11-19 07:19:58 +00:00
fix: remove history state fallback + asyncdata (#687)
This commit is contained in:
parent
451c4a0701
commit
72ce43dde9
4 changed files with 10 additions and 19 deletions
|
@ -15,7 +15,7 @@ const publishWidget = ref()
|
||||||
|
|
||||||
const { data: status, pending, refresh: refreshStatus } = useAsyncData(
|
const { data: status, pending, refresh: refreshStatus } = useAsyncData(
|
||||||
`status:${id}`,
|
`status:${id}`,
|
||||||
async () => (window.history.state?.status as Status | undefined) ?? await fetchStatus(id),
|
() => fetchStatus(id),
|
||||||
{ watch: [isMastoInitialised], immediate: isMastoInitialised.value },
|
{ watch: [isMastoInitialised], immediate: isMastoInitialised.value },
|
||||||
)
|
)
|
||||||
const masto = useMasto()
|
const masto = useMasto()
|
||||||
|
|
|
@ -9,16 +9,13 @@ definePageMeta({ name: 'account-index' })
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
|
|
||||||
const { data: account } = await useAsyncData(`account:${handle}`, async () => (
|
const account = await fetchAccountByHandle(handle)
|
||||||
window.history.state?.account as Account | undefined)
|
|
||||||
?? await fetchAccountByHandle(handle),
|
|
||||||
)
|
|
||||||
|
|
||||||
const paginator = useMasto().accounts.iterateStatuses(account.value!.id, { excludeReplies: true })
|
const paginator = useMasto().accounts.iterateStatuses(account.id, { excludeReplies: true })
|
||||||
|
|
||||||
if (account) {
|
if (account) {
|
||||||
useHeadFixed({
|
useHeadFixed({
|
||||||
title: () => `${t('account.posts')} | ${getDisplayName(account.value!)} (@${account.value!.acct})`,
|
title: () => `${t('account.posts')} | ${getDisplayName(account)} (@${account.acct})`,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -7,16 +7,13 @@ const { t } = useI18n()
|
||||||
const params = useRoute().params
|
const params = useRoute().params
|
||||||
const handle = $(computedEager(() => params.account as string))
|
const handle = $(computedEager(() => params.account as string))
|
||||||
|
|
||||||
const { data: account } = await useAsyncData(`account:${handle}`, async () => (
|
const account = await fetchAccountByHandle(handle)
|
||||||
window.history.state?.account as Account | undefined)
|
|
||||||
?? await fetchAccountByHandle(handle),
|
|
||||||
)
|
|
||||||
|
|
||||||
const paginator = useMasto().accounts.iterateStatuses(account.value!.id, { onlyMedia: true, excludeReplies: false })
|
const paginator = useMasto().accounts.iterateStatuses(account.id, { onlyMedia: true, excludeReplies: false })
|
||||||
|
|
||||||
if (account) {
|
if (account) {
|
||||||
useHeadFixed({
|
useHeadFixed({
|
||||||
title: () => `${t('tab.media')} | ${getDisplayName(account.value!)} (@${account.value!.acct})`,
|
title: () => `${t('tab.media')} | ${getDisplayName(account)} (@${account.acct})`,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -7,16 +7,13 @@ const { t } = useI18n()
|
||||||
const params = useRoute().params
|
const params = useRoute().params
|
||||||
const handle = $(computedEager(() => params.account as string))
|
const handle = $(computedEager(() => params.account as string))
|
||||||
|
|
||||||
const { data: account } = await useAsyncData(`account:${handle}`, async () => (
|
const account = await fetchAccountByHandle(handle)
|
||||||
window.history.state?.account as Account | undefined)
|
|
||||||
?? await fetchAccountByHandle(handle),
|
|
||||||
)
|
|
||||||
|
|
||||||
const paginator = useMasto().accounts.iterateStatuses(account.value!.id, { excludeReplies: false })
|
const paginator = useMasto().accounts.iterateStatuses(account.id, { excludeReplies: false })
|
||||||
|
|
||||||
if (account) {
|
if (account) {
|
||||||
useHeadFixed({
|
useHeadFixed({
|
||||||
title: () => `${t('tab.posts_with_replies')} | ${getDisplayName(account.value!)} (@${account.value!.acct})`,
|
title: () => `${t('tab.posts_with_replies')} | ${getDisplayName(account)} (@${account.acct})`,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue