feat: Implement plan for bug fixes

This commit is contained in:
gpt-engineer-app[bot]
2025-10-21 13:27:23 +00:00
parent 827f0f8ea5
commit ce6c9d6866
14 changed files with 94 additions and 59 deletions

View File

@@ -15,6 +15,8 @@ import {
import { cn } from '@/lib/utils';
import { getErrorMessage } from '@/lib/errorHandler';
import { supabase } from '@/integrations/supabase/client';
import { invokeWithTracking } from '@/lib/edgeFunctionTracking';
import { useAuth } from '@/hooks/useAuth';
interface PhotoUploadProps {
onUploadComplete?: (urls: string[], imageId?: string) => void;
@@ -111,8 +113,9 @@ export function PhotoUpload({
const uploadFile = async (file: File, previewUrl: string): Promise<UploadedImage> => {
try {
const { data: uploadData, error: uploadError } = await supabase.functions.invoke('upload-image', {
body: {
const { data: uploadData, error: uploadError, requestId } = await invokeWithTracking(
'upload-image',
{
metadata: {
filename: file.name,
size: file.size,
@@ -120,8 +123,9 @@ export function PhotoUpload({
uploadedAt: new Date().toISOString()
},
variant: isAvatar ? 'avatar' : 'public'
}
});
},
undefined
);
if (uploadError) {
console.error('Upload URL error:', uploadError);
@@ -239,10 +243,12 @@ export function PhotoUpload({
try {
if (isAvatar && currentImageId) {
try {
await supabase.functions.invoke('upload-image', {
method: 'DELETE',
body: { imageId: currentImageId }
});
await invokeWithTracking(
'upload-image',
{ imageId: currentImageId },
undefined,
'DELETE'
);
} catch (deleteError) {
console.warn('Failed to delete old avatar:', deleteError);
}