fix(gallery/filters): make feedback filters work globally when no guest_id is provided; remove guest_id from client photos query\n\n- Backend /api/gallery/:slug/photos: if filter present and guest_id missing, filter by like_count/favorite_count\n- Frontend useGalleryPhotos: stop passing random guestId (does not match server guest_identifier)\n\nThis makes Liked/Favorited filters reflect photos with aggregate feedback counts as expected.

This commit is contained in:
2025-09-16 09:28:12 +02:00
parent 3a6d06192a
commit 5b2561b6f1
2 changed files with 14 additions and 2 deletions
+3 -2
View File
@@ -14,7 +14,8 @@ export const useGalleryInfo = (slug: string, token?: string) => {
export const useGalleryPhotos = (slug: string, filter?: 'liked' | 'favorited' | 'all', guestId?: string, enabled: boolean = true) => {
return useQuery({
queryKey: ['gallery-photos', slug, filter, guestId],
queryFn: () => galleryService.getGalleryPhotos(slug, filter, guestId),
// Do not pass guestId for now; backend will apply global filters when guest_id is absent
queryFn: () => galleryService.getGalleryPhotos(slug, filter, undefined),
enabled,
retry: 1,
staleTime: 5 * 60 * 1000, // 5 minutes
@@ -63,4 +64,4 @@ export const useDownloadAllPhotos = () => {
toast.error('Failed to download photos');
},
});
};
};