Show bookmark heart to all users, redirect to login if not authenticated
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
c62229c795
commit
ced192b65e
1 changed files with 6 additions and 1 deletions
|
|
@ -1,5 +1,6 @@
|
|||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Heart } from 'lucide-vue-next'
|
||||
import { useAuth } from '@/composables/useAuthService'
|
||||
|
|
@ -15,6 +16,7 @@ const props = defineProps<{
|
|||
kind?: number
|
||||
}>()
|
||||
|
||||
const router = useRouter()
|
||||
const { isAuthenticated } = useAuth()
|
||||
const { isBookmarked, toggleBookmark } = useBookmarks()
|
||||
|
||||
|
|
@ -22,13 +24,16 @@ const activityKind = computed(() => props.kind ?? NIP52_KINDS.CALENDAR_TIME_EVEN
|
|||
const bookmarked = computed(() => isBookmarked(activityKind.value, props.pubkey, props.dTag))
|
||||
|
||||
function handleToggle() {
|
||||
if (!isAuthenticated.value) {
|
||||
router.push('/login')
|
||||
return
|
||||
}
|
||||
toggleBookmark(activityKind.value, props.pubkey, props.dTag)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Button
|
||||
v-if="isAuthenticated"
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
class="h-8 w-8"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue