This commit is contained in:
Your Name committed 2026-06-19 18:58:07 -04:00
1 parent ce6fa69b09
commit 716bb98b50
4 files changed
+11 -8

No files matched your search

+6 -4
View File
@@ -68,16 +68,18 @@ function resolveApiBase() {
if (envValue) {
const isDev = Boolean(viteEnv?.DEV)
const isLocalhostUrl = /^https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?\/api\/?$/.test(envValue)
const win = (globalThis as any).window
if (isDev && typeof window !== 'undefined' && isLocalhostUrl) {
return `${window.location.protocol}//${window.location.hostname}:${DEFAULT_DEV_API_PORT}/api`
if (isDev && typeof win !== 'undefined' && isLocalhostUrl) {
return `${win.location.protocol}//${win.location.hostname}:${DEFAULT_DEV_API_PORT}/api`
}
return envValue
}
if (typeof window !== 'undefined') {
return `${window.location.protocol}//${window.location.hostname}:${DEFAULT_DEV_API_PORT}/api`
const win = (globalThis as any).window
if (typeof win !== 'undefined') {
return `${win.location.protocol}//${win.location.hostname}:${DEFAULT_DEV_API_PORT}/api`
}
return 'http://localhost:3000/api'