feat: Complete type safety for Phase 1 & 2

This commit is contained in:
gpt-engineer-app[bot]
2025-10-17 15:23:15 +00:00
parent 77deb62742
commit debb5325bd
5 changed files with 120 additions and 40 deletions

View File

@@ -5,6 +5,7 @@
import { useState, useEffect } from 'react';
import { supabase } from '@/integrations/supabase/client';
import { getErrorMessage } from '@/lib/errorHandler';
import type { PhotoSubmissionItem } from '@/types/photo-submissions';
interface UsePhotoSubmissionItemsResult {
@@ -61,9 +62,10 @@ export function usePhotoSubmissionItems(
if (itemsError) throw itemsError;
setPhotos(data || []);
} catch (err: any) {
console.error('Error fetching photo submission items:', err);
setError(err.message || 'Failed to load photos');
} catch (error) {
const errorMsg = getErrorMessage(error);
console.error('Error fetching photo submission items:', errorMsg);
setError(errorMsg);
setPhotos([]);
} finally {
setLoading(false);