Fix interested state for anonymous accounts

The EventCard logic assume interestedIds not being present means the
account can't set events as interested.  Fix this logic by checking if
the account is valid instead and always have interestedIds present on
the account store.
This commit is contained in:
Hornwitser 2025-05-31 22:05:20 +02:00
parent 04b9707272
commit 2cb56247be
2 changed files with 6 additions and 6 deletions

View file

@ -5,13 +5,13 @@
<p v-if="event.interested">
{{ event.interested }} interested
</p>
<p v-if="accountStore.interestedIds">
<p v-if="accountStore.valid">
<button
class="interested"
:class="{ active: accountStore.interestedIds?.has(event.id) }"
:class="{ active: accountStore.interestedIds.has(event.id) }"
@click="toggle(event.id, event.slots.map(slot => slot.id))"
>
{{ accountStore.interestedIds?.has(event.id) ? "✔ interested" : "🔔 interested?" }}
{{ accountStore.interestedIds.has(event.id) ? "✔ interested" : "🔔 interested?" }}
</button>
</p>
@ -20,7 +20,7 @@
<li v-for="slot in event.slots" :key="slot.id">
{{ formatTime(slot.start) }} - {{ formatTime(slot.end) }}
<button
v-if="accountStore.interestedIds && event.slots.length > 1"
v-if="accountStore.valid && event.slots.length > 1"
class="interested"
:disabled="accountStore.interestedIds.has(event.id)"
:class="{ active: accountStore.interestedIds.has(event.id) || accountStore.interestedIds.has(slot.id) }"