@@ -55,7 +55,8 @@ export default function SetupWizard() {
5555 }
5656 }
5757 fetchStatus ( )
58- } , [ navigate , message ] )
58+ // eslint-disable-next-line react-hooks/exhaustive-deps
59+ } , [ ] )
5960
6061 const handleTestConnection = async ( ) => {
6162 try {
@@ -185,8 +186,11 @@ export default function SetupWizard() {
185186 } )
186187
187188 // Wait for server to restart
189+ // Use the API endpoint from the form values or the already configured endpoint
190+ const endpointToCheck = values . api_endpoint || apiEndpoint || window . location . origin
191+
188192 try {
189- await waitForServerRestart ( )
193+ await waitForServerRestart ( endpointToCheck )
190194
191195 // Success - server is back up
192196 message . success ( {
@@ -216,22 +220,23 @@ export default function SetupWizard() {
216220 * Wait for the server to restart after setup completion
217221 * Polls the health endpoint until server is back online
218222 */
219- const waitForServerRestart = async ( ) : Promise < void > => {
223+ const waitForServerRestart = async ( configuredEndpoint : string ) : Promise < void > => {
220224 const maxAttempts = 60 // 60 seconds max wait
221225 const delayMs = 1000 // Check every second
222226
227+ // Determine the API endpoint URL - use same logic as api client
228+ let apiEndpointUrl = configuredEndpoint
229+
223230 // Wait for server to start shutting down
224231 await new Promise ( ( resolve ) => setTimeout ( resolve , 2000 ) )
225232
226- // Poll health endpoint
233+ // Poll setup status endpoint to check if server has restarted
227234 for ( let i = 0 ; i < maxAttempts ; i ++ ) {
228235 try {
229- const response = await fetch ( '/api/setup.status' , {
230- method : 'GET' ,
231- cache : 'no-cache' ,
232- headers : {
233- 'Cache-Control' : 'no-cache'
234- }
236+ // Simple GET request without custom headers to avoid CORS preflight issues
237+ // Add timestamp to prevent caching
238+ const response = await fetch ( `${ apiEndpointUrl } /api/setup.status?t=${ Date . now ( ) } ` , {
239+ method : 'GET'
235240 } )
236241
237242 if ( response . ok ) {
0 commit comments