2022-11-15 16:56:11 +01:00
|
|
|
<script setup lang="ts">
|
|
|
|
import type { Account } from 'masto'
|
|
|
|
|
2022-11-22 14:03:36 +01:00
|
|
|
const { account } = defineProps<{
|
2022-11-15 16:56:11 +01:00
|
|
|
account: Account
|
|
|
|
}>()
|
2022-11-21 23:59:51 +01:00
|
|
|
|
|
|
|
const masto = await useMasto()
|
|
|
|
|
2022-11-22 14:03:36 +01:00
|
|
|
const relationship = $(useRelationship(account))
|
2022-11-21 23:59:51 +01:00
|
|
|
|
|
|
|
function unfollow() {
|
|
|
|
masto.accounts.unfollow(account.id)
|
2022-11-22 14:03:36 +01:00
|
|
|
relationship!.following = false
|
2022-11-21 23:59:51 +01:00
|
|
|
}
|
|
|
|
function follow() {
|
|
|
|
masto.accounts.follow(account.id)
|
2022-11-22 14:03:36 +01:00
|
|
|
relationship!.following = true
|
2022-11-21 23:59:51 +01:00
|
|
|
}
|
2022-11-15 16:56:11 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div flex justify-between>
|
|
|
|
<AccountInfo :account="account" p3 />
|
|
|
|
<div h-full p5>
|
2022-11-22 14:03:36 +01:00
|
|
|
<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" />
|
2022-11-15 16:56:11 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|