mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 15: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;
|
const maxAttempts = 30;
|
||||||
|
|
||||||
while (attempts < maxAttempts) {
|
while (attempts < maxAttempts) {
|
||||||
const statusResponse = await supabase.functions.invoke('upload-image', {
|
const { data: { session } } = await supabase.auth.getSession();
|
||||||
body: { id: cloudflareId },
|
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) {
|
if (statusResponse.ok) {
|
||||||
const status: UploadSuccessResponse = statusResponse.data;
|
const status: UploadSuccessResponse = await statusResponse.json();
|
||||||
if (status.uploaded && status.urls) {
|
if (status.uploaded && status.urls) {
|
||||||
return status.urls.public;
|
return status.urls.public;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user