릴리스: v0.1.6 MariaDB 개발 환경 및 저장소 설정 정리
This commit is contained in:
9
frontend/src/lib/runtime.js
Normal file
9
frontend/src/lib/runtime.js
Normal file
@@ -0,0 +1,9 @@
|
||||
const FALLBACK_API_ORIGIN = 'http://localhost:5179'
|
||||
|
||||
export const API_ORIGIN = (import.meta.env.VITE_API_ORIGIN || FALLBACK_API_ORIGIN).replace(/\/+$/, '')
|
||||
|
||||
export function toApiUrl(path = '') {
|
||||
if (!path) return API_ORIGIN
|
||||
if (/^https?:\/\//.test(path)) return path
|
||||
return `${API_ORIGIN}${path.startsWith('/') ? path : `/${path}`}`
|
||||
}
|
||||
Reference in New Issue
Block a user