From 48b32e5d0e87727a293f3e7620aaa5cc3b4f03d0 Mon Sep 17 00:00:00 2001 From: Arco Mul Date: Sun, 9 Jun 2024 21:55:13 +0200 Subject: [PATCH] fix: prevent showing reservation as active user's reservation when user is member of location --- app/stores/user.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/stores/user.ts b/app/stores/user.ts index abbfd3e..948a35c 100644 --- a/app/stores/user.ts +++ b/app/stores/user.ts @@ -30,8 +30,14 @@ export const useUserStore = defineStore<"user", State>("user", { }, async fetchUserReservations() { const { pb } = usePocketbase(); - const reservations = await pb.collection("reservations").getFullList(); - this.reservations = reservations; + if (pb.authStore?.model?.id) { + const reservations = await pb.collection("reservations").getFullList({ + filter: pb.filter("user = {:user}", { + user: pb.authStore.model.id, + }), + }); + this.reservations = reservations; + } }, setReservationIntent(locationSlug: string, productId: string) { this.reservationIntent.locationSlug = locationSlug;