feat: unify follow button (#25)

This commit is contained in:
patak 2022-11-22 23:40:20 +01:00 committed by GitHub
parent ac156034d1
commit 7beaab0baf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 33 deletions

View file

@ -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
}
</script>
<template>
<div flex justify-between>
<AccountInfo :account="account" p3 />
<div h-full p5>
<div v-if="relationship?.following === true" color-purple hover:color-gray hover:cursor-pointer i-ri:user-unfollow-fill @click="unfollow" />
<div v-else-if="relationship?.following === false" color-gray hover:color-purple hover:cursor-pointer i-ri:user-follow-fill @click="follow" />
<AccountInfo :account="account" p1 />
<div h-full p1>
<AccountFollowButton :account="account" />
</div>
</div>
</template>