Fix: Correct polling method for upload status

This commit is contained in:
gpt-engineer-app[bot]
2025-09-29 18:07:33 +00:00
parent 45d7ef9e6e
commit 15d95daec4

View File

@@ -119,12 +119,19 @@ export function UppyPhotoUpload({
const maxAttempts = 30;
while (attempts < maxAttempts) {
const statusResponse = await supabase.functions.invoke('upload-image', {
body: { id: cloudflareId },
});
const { data: { session } } = await supabase.auth.getSession();
const statusResponse = await fetch(
`https://ydvtmnrszybqnbcqbdcy.supabase.co/functions/v1/upload-image?id=${cloudflareId}`,
{
headers: {
'Authorization': `Bearer ${session?.access_token || ''}`,
'apikey': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InlkdnRtbnJzenlicW5iY3FiZGN5Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTgzMjYzNTYsImV4cCI6MjA3MzkwMjM1Nn0.DM3oyapd_omP5ZzIlrT0H9qBsiQBxBRgw2tYuqgXKX4',
}
}
);
if (!statusResponse.error && statusResponse.data) {
const status: UploadSuccessResponse = statusResponse.data;
if (statusResponse.ok) {
const status: UploadSuccessResponse = await statusResponse.json();
if (status.uploaded && status.urls) {
return status.urls.public;
}