mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-30 08:27:05 -05:00
Remove debug console logs
This commit is contained in:
@@ -19,69 +19,36 @@ export function PhotoSubmissionDisplay({ submissionId }: PhotoSubmissionDisplayP
|
||||
}, [submissionId]);
|
||||
|
||||
const fetchPhotos = async () => {
|
||||
console.log('🖼️ PhotoSubmissionDisplay: Starting fetch for submission:', submissionId);
|
||||
|
||||
try {
|
||||
// Check user auth and roles
|
||||
const { data: session } = await supabase.auth.getSession();
|
||||
const userId = session?.session?.user?.id;
|
||||
console.log('👤 Current user ID:', userId);
|
||||
|
||||
if (userId) {
|
||||
const { data: roles } = await supabase
|
||||
.from('user_roles')
|
||||
.select('role')
|
||||
.eq('user_id', userId);
|
||||
console.log('👤 Current user roles:', roles);
|
||||
}
|
||||
|
||||
// Step 1: Get photo_submission_id from submission_id
|
||||
console.log('📸 Step 1: Querying photo_submissions table...');
|
||||
const { data: photoSubmission, error: photoSubmissionError } = await supabase
|
||||
.from('photo_submissions')
|
||||
.select('id, entity_type, title')
|
||||
.eq('submission_id', submissionId)
|
||||
.maybeSingle();
|
||||
|
||||
console.log('📸 Photo submission query result:', {
|
||||
photoSubmission,
|
||||
error: photoSubmissionError
|
||||
});
|
||||
|
||||
if (photoSubmissionError) {
|
||||
console.error('❌ Error fetching photo_submission:', photoSubmissionError);
|
||||
throw photoSubmissionError;
|
||||
}
|
||||
|
||||
if (!photoSubmission) {
|
||||
console.log('⚠️ No photo_submission found for submission_id:', submissionId);
|
||||
setPhotos([]);
|
||||
setLoading(false);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('✅ Found photo_submission ID:', photoSubmission.id);
|
||||
|
||||
// Step 2: Get photo items using photo_submission_id
|
||||
console.log('🖼️ Step 2: Querying photo_submission_items table...');
|
||||
const { data, error } = await supabase
|
||||
.from('photo_submission_items')
|
||||
.select('*')
|
||||
.eq('photo_submission_id', photoSubmission.id)
|
||||
.order('order_index');
|
||||
|
||||
console.log('🖼️ Photo items query result:', {
|
||||
itemCount: data?.length,
|
||||
error
|
||||
});
|
||||
|
||||
if (error) {
|
||||
console.error('❌ Error fetching photo_submission_items:', error);
|
||||
throw error;
|
||||
}
|
||||
|
||||
setPhotos(data || []);
|
||||
console.log(`✅ Successfully loaded ${data?.length || 0} photos`);
|
||||
} catch (error: unknown) {
|
||||
const errorMsg = getErrorMessage(error);
|
||||
console.error('❌ PhotoSubmissionDisplay error:', errorMsg);
|
||||
|
||||
Reference in New Issue
Block a user