Mercurial
comparison love/epi/src/utils/index.ts @ 38:cf9caa4abc3e
[Love] FE and BE. Can chat and render images. Also created MCP for powerpoint generations.
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Mon, 01 Dec 2025 20:35:56 -0800 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 37:fb9bcd3145cb | 38:cf9caa4abc3e |
|---|---|
| 1 const API_BASE_URL = import.meta.env.VITE_API_BASE_URL || 'http://localhost:8000'; | |
| 2 | |
| 3 export function getApiBaseUrl(): string { | |
| 4 return API_BASE_URL.endsWith('/') ? API_BASE_URL.slice(0, -1) : API_BASE_URL; | |
| 5 } | |
| 6 | |
| 7 // need to include sequential | |
| 8 export function apiUrl(path: string): string { | |
| 9 const base = getApiBaseUrl(); | |
| 10 | |
| 11 const cleanPath = path.startsWith('/') ? path : `/${path}`; | |
| 12 return `${base}${cleanPath}`; | |
| 13 } | |
| 14 | |
| 15 export function wsUrl(path: string): string { | |
| 16 const base = getApiBaseUrl(); | |
| 17 const cleanPath = path.startsWith('/') ? path : `/${path}`; | |
| 18 | |
| 19 const wsBase = base.replace(/^http/, 'ws'); | |
| 20 return `${wsBase}${cleanPath}`; | |
| 21 } |