File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change 11import { useState , useCallback } from "react" ;
2- import { API_BASE } from "@/lib/api" ;
2+ import { API_BASE , FORCE_SYNC } from "@/lib/api" ;
33import { createProcessingJob , pollJob , fetchJobResult } from "@/lib/jobs" ;
44import { Card , CardContent } from "@/components/ui/card" ;
55import { Button } from "@/components/ui/button" ;
@@ -93,11 +93,12 @@ const VideoUpload = ({ onVideoProcessed }: VideoUploadProps) => {
9393
9494 // Prefer async job flow in production to avoid platform timeouts; keep sync in dev
9595 let blob : Blob ;
96- if ( import . meta. env . DEV && ! API_BASE ) {
96+ if ( ( import . meta. env . DEV && ! API_BASE ) || FORCE_SYNC ) {
9797 // local dev, use sync endpoint via Vite proxy
9898 const form = new FormData ( ) ;
9999 form . append ( "video" , uploadedVideo ) ;
100- const res = await fetch ( "/api/process" , { method : "POST" , body : form } ) ;
100+ const endpoint = FORCE_SYNC && API_BASE ? `${ API_BASE } /api/process` : "/api/process" ;
101+ const res = await fetch ( endpoint , { method : "POST" , body : form } ) ;
101102 if ( ! res . ok ) {
102103 const text = await res . text ( ) ;
103104 throw new Error ( text || `Request failed: ${ res . status } ` ) ;
Original file line number Diff line number Diff line change @@ -7,3 +7,5 @@ const DEFAULT_BACKEND = "https://sportiq-j4hv.onrender.com";
77export const API_BASE = import . meta. env . PROD
88 ? ( import . meta. env . VITE_BACKEND_URL || DEFAULT_BACKEND )
99 : ( import . meta. env . VITE_BACKEND_URL || "" ) ;
10+
11+ export const FORCE_SYNC = Boolean ( import . meta. env . VITE_FORCE_SYNC ) ;
You can’t perform that action at this time.
0 commit comments