feat: use masto client

This commit is contained in:
Anthony Fu 2022-11-14 10:20:07 +08:00
parent 4adab40932
commit 90c45b435f
14 changed files with 96 additions and 205 deletions

13
pages/@[user]/index.vue Normal file
View file

@ -0,0 +1,13 @@
<script setup lang="ts">
const props = defineProps<{
modelValue?: boolean
}>()
const params = useRoute().params
</script>
<template>
<div>
{{ params }}
</div>
</template>

View file

@ -1,12 +1,12 @@
<script setup lang="ts">
const client = useClient()
const { data: posts } = await useAsyncData(() => client.getPublicTimeline())
const masto = await useMasto()
const { data: timelines } = await useAsyncData('public-timelines', () => masto.timelines.fetchPublic().then(r => r.value))
</script>
<template>
<div w-150>
<template v-for="post in posts" :key="post.id">
<PostCard :post="post" border="t gray/10" pt-4 />
<template v-for="status of timelines" :key="status.id">
<StatusCard :status="status" border="t gray/10" pt-4 />
</template>
</div>
</template>