|
|
@@ -24,9 +24,20 @@ function getApiConfig() {
|
|
|
};
|
|
|
}
|
|
|
|
|
|
- // Fallback for development mode
|
|
|
+ // Fallback for development mode - use current window location
|
|
|
+ if (typeof window !== 'undefined') {
|
|
|
+ const protocol = window.location.protocol;
|
|
|
+ const host = window.location.hostname;
|
|
|
+ const port = window.location.port;
|
|
|
+ return {
|
|
|
+ apiUrl: `${protocol}//${host}:${port}`,
|
|
|
+ apiBase: '/api',
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ // Server-side fallback
|
|
|
return {
|
|
|
- apiUrl: process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8080',
|
|
|
+ apiUrl: process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8081',
|
|
|
apiBase: process.env.NEXT_PUBLIC_API_BASE_PATH || '/api',
|
|
|
};
|
|
|
}
|
|
|
@@ -156,7 +167,7 @@ class ApiClient {
|
|
|
|
|
|
// Enhanced health check with multiple endpoints and better error handling
|
|
|
async checkHealth(): Promise<HealthStatus> {
|
|
|
- const endpoints = ['/health', '/status', '/'];
|
|
|
+ const endpoints = ['/queue/status', '/health', '/status', '/'];
|
|
|
|
|
|
for (const endpoint of endpoints) {
|
|
|
try {
|
|
|
@@ -172,7 +183,16 @@ class ApiClient {
|
|
|
if (response.ok) {
|
|
|
const data = await response.json();
|
|
|
|
|
|
- // Normalize different possible response formats
|
|
|
+ // For queue status, consider it healthy if it returns valid structure
|
|
|
+ if (endpoint === '/queue/status' && data.queue) {
|
|
|
+ return {
|
|
|
+ status: 'ok',
|
|
|
+ message: 'API is running and queue is accessible',
|
|
|
+ timestamp: new Date().toISOString(),
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ // For other health endpoints
|
|
|
const healthStatus: HealthStatus = {
|
|
|
status: 'ok',
|
|
|
message: 'API is running',
|