diff --git a/components/account/AccountCard.vue b/components/account/AccountCard.vue index f3d2e54c..64995ecf 100644 --- a/components/account/AccountCard.vue +++ b/components/account/AccountCard.vue @@ -1,25 +1,21 @@ @@ -27,8 +23,8 @@ function follow() {
-
-
+
+
diff --git a/components/account/AccountHeader.vue b/components/account/AccountHeader.vue index 9263c86e..bd0732ad 100644 --- a/components/account/AccountHeader.vue +++ b/components/account/AccountHeader.vue @@ -5,22 +5,14 @@ const { account } = defineProps<{ account: Account }>() -let isFollowing = $ref() -let isFollowedBy = $ref() +const relationship = $(useRelationship(account)) let masto: MastoClient -onMounted(async () => { - masto ??= await useMasto() - const relationship = (await masto.accounts.fetchRelationships([account.id]))[0] - isFollowing = relationship.following - isFollowedBy = relationship.followedBy -}) - async function toggleFollow() { - isFollowing = !isFollowing + relationship!.following = !relationship!.following masto ??= await useMasto() - await masto.accounts[isFollowing ? 'follow' : 'unfollow'](account.id) + await masto.accounts[relationship!.following ? 'follow' : 'unfollow'](account.id) } const createdAt = $computed(() => { @@ -50,9 +42,9 @@ const createdAt = $computed(() => {
-