elmeg-demo/frontend/lib/api-config.ts
fullsizemalt 6dd88d4e2d fix: improve session persistence and review saving
- Increase token expiry from 30 minutes to 7 days
- Remove internal session.commit() calls from gamification services
- Add try/except around gamification logic in review creation
- Add elmeg.runfoo.run hostname support in frontend api-config
2025-12-24 21:44:26 -08:00

12 lines
407 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 === 'elmeg.xyz' || hostname === 'elmeg.runfoo.run') {
return '/api'
}
return process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000'
}