fediversion/frontend/lib/api-config.ts
fullsizemalt 29c5d30ebb feat: Add multi-vertical frontend infrastructure
Phase 3 - Frontend Multi-Vertical Support:
- Add VerticalContext for band state management
- Add BandSelector dropdown component
- Create dynamic [vertical] routes for shows, songs, venues
- Update navbar to use band selector and vertical-aware links
- Update api-config.ts for Fediversion domain
- Rebrand from Elmeg to Fediversion
2025-12-28 13:56:22 -08:00

19 lines
654 B
TypeScript

export function getApiUrl() {
if (typeof window === 'undefined') {
// Server-side
return process.env.INTERNAL_API_URL || 'http://localhost:8000'
}
// Client-side
const hostname = window.location.hostname
if (hostname === 'fediversion.xyz' || hostname === 'fediversion.runfoo.run' ||
hostname === 'elmeg.xyz' || hostname === 'elmeg.runfoo.run') {
return '/api'
}
return process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000'
}
// Get API URL with vertical scope
export function getVerticalApiUrl(verticalSlug: string) {
const base = getApiUrl()
return `${base}/v/${verticalSlug}`
}