From 7beaab0bafcac2372e76e5b94ec9af1170a23d6d Mon Sep 17 00:00:00 2001 From: patak Date: Tue, 22 Nov 2022 23:40:20 +0100 Subject: [PATCH] feat: unify follow button (#25) --- components/account/AccountCard.vue | 20 +++----------- components/account/AccountFollowButton.vue | 31 ++++++++++++++++++++++ components/account/AccountHeader.vue | 18 ++----------- 3 files changed, 36 insertions(+), 33 deletions(-) create mode 100644 components/account/AccountFollowButton.vue diff --git a/components/account/AccountCard.vue b/components/account/AccountCard.vue index 64995ecf..80632d08 100644 --- a/components/account/AccountCard.vue +++ b/components/account/AccountCard.vue @@ -4,27 +4,13 @@ import type { Account } from 'masto' const { account } = defineProps<{ account: Account }>() - -const masto = await useMasto() - -const relationship = $(useRelationship(account)) - -function unfollow() { - masto.accounts.unfollow(account.id) - relationship!.following = false -} -function follow() { - masto.accounts.follow(account.id) - relationship!.following = true -} diff --git a/components/account/AccountFollowButton.vue b/components/account/AccountFollowButton.vue new file mode 100644 index 00000000..d20becef --- /dev/null +++ b/components/account/AccountFollowButton.vue @@ -0,0 +1,31 @@ + + + diff --git a/components/account/AccountHeader.vue b/components/account/AccountHeader.vue index bd0732ad..ed33e688 100644 --- a/components/account/AccountHeader.vue +++ b/components/account/AccountHeader.vue @@ -1,20 +1,10 @@