fix: 完善 API Token 验收细节

This commit is contained in:
2026-05-23 03:09:40 +08:00
parent 4784ed36ca
commit 68e297b0ad
5 changed files with 31 additions and 11 deletions
+5 -1
View File
@@ -357,13 +357,17 @@ function parseFilename(disposition: string | null): string {
return plainMatch?.[1] || '';
}
function apiUrl(url: string): string {
export function apiUrl(url: string): string {
if (!API_BASE || /^https?:\/\//i.test(url)) {
return url;
}
return `${API_BASE}${url.startsWith('/') ? url : `/${url}`}`;
}
export function getApiBaseUrl(): string {
return API_BASE || window.location.origin;
}
function resolveApiBase(): string {
const configured = (import.meta.env.VITE_API_BASE || '').replace(/\/$/, '');
if (configured) {