mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 13:11:12 -05:00
Fix: Correct polling method for upload status
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user