fix(api): remove fallback URLs, throw if env var not defined
continuous-integration/drone/push Build is failing Details

Per user feedback and Chief Cole direction (Chief_Cole-20251107123442):
- Remove fallback URLs from all API clients
- Throw error if NEXT_PUBLIC_PYTHON_API_URL not defined
- Standardize on NEXT_PUBLIC_PYTHON_API_URL env var across all clients
- Production URL: https://api.playchoo.com (staging/prod share hostname)

Updated files:
- src/lib/api/courts.ts
- src/lib/api/materialisation.ts
- src/lib/api/slot-definitions.ts

All clients now fail fast with clear error if env var missing.
Build tested and passed.
master
Guillermo Pages 1 month ago
parent 9a9c3a3b95
commit cb255cf1f3

@ -14,7 +14,11 @@ import type {
CourtError, CourtError,
} from '@/src/types/courts'; } from '@/src/types/courts';
const API_BASE_URL = process.env.NEXT_PUBLIC_API_BASE_URL || 'https://staging.api.playchoo.com'; const API_BASE_URL = process.env.NEXT_PUBLIC_PYTHON_API_URL;
if (!API_BASE_URL) {
throw new Error('NEXT_PUBLIC_PYTHON_API_URL environment variable is not defined');
}
type ApiResult<T> = type ApiResult<T> =
| { success: true; data: T } | { success: true; data: T }

@ -12,7 +12,11 @@ import type {
MaterialisationError, MaterialisationError,
} from '@/src/types/materialisation'; } from '@/src/types/materialisation';
const API_BASE_URL = process.env.NEXT_PUBLIC_API_BASE_URL || 'https://staging.api.playchoo.com'; const API_BASE_URL = process.env.NEXT_PUBLIC_PYTHON_API_URL;
if (!API_BASE_URL) {
throw new Error('NEXT_PUBLIC_PYTHON_API_URL environment variable is not defined');
}
type ApiResult<T> = type ApiResult<T> =
| { success: true; data: T } | { success: true; data: T }

@ -4,7 +4,11 @@ import type {
SlotDefinitionError, SlotDefinitionError,
} from '@/src/types/slot-definitions'; } from '@/src/types/slot-definitions';
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || 'https://api.playchoo.com'; const API_BASE_URL = process.env.NEXT_PUBLIC_PYTHON_API_URL;
if (!API_BASE_URL) {
throw new Error('NEXT_PUBLIC_PYTHON_API_URL environment variable is not defined');
}
type ApiResult<T> = type ApiResult<T> =
| { success: true; data: T } | { success: true; data: T }

Loading…
Cancel
Save