init project
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
/** Prefix for Laravel API when the SPA is served from another origin (production). Empty in dev with Vite proxy. */
|
||||
export function apiOrigin(): string {
|
||||
const v = import.meta.env.VITE_API_ORIGIN
|
||||
return typeof v === 'string' ? v.replace(/\/$/, '') : ''
|
||||
}
|
||||
|
||||
export function apiUrl(path: string): string {
|
||||
const base = apiOrigin()
|
||||
const p = path.startsWith('/') ? path : `/${path}`
|
||||
return `${base}${p}`
|
||||
}
|
||||
Reference in New Issue
Block a user