feat: support more actions for user

This commit is contained in:
三咲智子 2022-11-26 20:58:10 +08:00
parent 3d7d2ca405
commit 84478984dc
No known key found for this signature in database
GPG key ID: 69992F2250DFD93E
12 changed files with 184 additions and 37 deletions

View file

@ -6,11 +6,17 @@ const { account } = defineProps<{
}>()
const isSelf = $computed(() => currentUser.value?.account.id === account.id)
const relationship = $(useRelationship(account))
let relationship = $(useRelationship(account))
async function toggleFollow() {
relationship!.following = !relationship!.following
await masto.accounts[relationship!.following ? 'follow' : 'unfollow'](account.id)
try {
relationship = await masto.accounts[relationship!.following ? 'follow' : 'unfollow'](account.id)
}
catch {
// TODO error handling
relationship!.following = !relationship!.following
}
}
</script>