elk/pages/home.vue

39 lines
970 B
Vue
Raw Normal View History

<script setup lang="ts">
2022-11-28 10:14:58 +00:00
import { useI18n } from 'vue-i18n'
definePageMeta({
middleware: 'auth',
alias: ['/signin/callback'],
})
if (useRoute().path === '/signin/callback') {
// This only cleans up the URL; page content should stay the same
useRouter().push('/home')
}
const masto = useMasto()
const paginator = masto.timelines.iterateHome()
const stream = await masto.stream.streamUser()
onBeforeUnmount(() => stream.disconnect())
2022-11-28 10:14:58 +00:00
const { t } = useI18n()
useHeadFixed({
2022-11-28 10:14:58 +00:00
title: () => t('nav_side.home'),
})
</script>
<template>
<MainContent>
<template #title>
2022-11-29 20:15:53 +00:00
<NuxtLink to="/home" text-lg font-bold flex items-center gap-2 @click="$scrollToTop">
<div i-ri:home-5-line />
<span>{{ $t('nav_side.home') }}</span>
</NuxtLink>
</template>
<slot>
<PublishWidget draft-key="home" border="b base" />
<TimelinePaginator v-bind="{ paginator, stream }" context="home" />
</slot>
</MainContent>
</template>