Skip to content

Commit 366824c

Browse files
committed
fix: 修复生产环境API_BASE为空导致接口调用失败
1 parent 984d27b commit 366824c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

web/src/composables/shortBase.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@ export const SHORT_BASE = (
66
: 'http://47.97.110.128'
77
)
88

9-
export const API_BASE = import.meta?.env?.VITE_API_BASE || ''
9+
export const API_BASE = (
10+
import.meta?.env?.VITE_API_BASE
11+
) || (
12+
typeof window !== 'undefined' && window.location && window.location.origin
13+
? window.location.origin
14+
: 'http://47.97.110.128'
15+
)
1016

1117
export function cleanShortUrl(url) {
1218
if (!url) return ''

0 commit comments

Comments
 (0)