mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-24 17:31:13 -05:00
feat: Implement plan for bug fixes
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user