feat: unify follow button (#25)
This commit is contained in:
parent
ac156034d1
commit
7beaab0baf
3 changed files with 36 additions and 33 deletions
|
@ -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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue