mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 18:11:12 -05:00
Fix photo submission approval logic
This commit is contained in:
@@ -39,6 +39,8 @@ export function EntityPhotoGallery({
|
||||
|
||||
const fetchPhotos = async () => {
|
||||
try {
|
||||
console.log('📷 [FETCH PHOTOS] Starting fetch for:', { entityId, entityType });
|
||||
|
||||
// Fetch photos directly from the photos table
|
||||
const { data: photoData, error } = await supabase
|
||||
.from('photos')
|
||||
@@ -48,6 +50,8 @@ export function EntityPhotoGallery({
|
||||
.order('order_index', { ascending: true })
|
||||
.order('created_at', { ascending: false });
|
||||
|
||||
console.log('📷 [FETCH PHOTOS] Query result:', { photoData, error, count: photoData?.length });
|
||||
|
||||
if (error) throw error;
|
||||
|
||||
// Map to Photo interface
|
||||
@@ -60,9 +64,10 @@ export function EntityPhotoGallery({
|
||||
created_at: photo.created_at,
|
||||
})) || [];
|
||||
|
||||
console.log('📷 [FETCH PHOTOS] Mapped photos:', mappedPhotos);
|
||||
setPhotos(mappedPhotos);
|
||||
} catch (error) {
|
||||
console.error('Error fetching photos:', error);
|
||||
console.error('📷 [FETCH PHOTOS] Error:', error);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user