fix(ui): replace stale BASE_URL references in api client

- use withApiBase for config yaml, auth file, and error log endpoints

- resolve UI build/typecheck failure in CI validate job
This commit is contained in:
Tam Nhu Tran committed 2026-02-18 03:15:03 +07:00
1 parent 70116cb3a1
commit 5a786263bc
1 file changed
+4 -4
+4 -4
View File
@@ -490,12 +490,12 @@ export const api = {
// Config YAML for Config tab // Config YAML for Config tab
getConfigYaml: async (): Promise<string> => { getConfigYaml: async (): Promise<string> => {
const res = await fetch(`${BASE_URL}/cliproxy/config.yaml`); const res = await fetch(withApiBase('/cliproxy/config.yaml'));
if (!res.ok) throw new Error('Failed to load config'); if (!res.ok) throw new Error('Failed to load config');
return res.text(); return res.text();
}, },
saveConfigYaml: async (content: string): Promise<void> => { saveConfigYaml: async (content: string): Promise<void> => {
const res = await fetch(`${BASE_URL}/cliproxy/config.yaml`, { const res = await fetch(withApiBase('/cliproxy/config.yaml'), {
method: 'PUT', method: 'PUT',
headers: { 'Content-Type': 'application/yaml' }, headers: { 'Content-Type': 'application/yaml' },
body: content, body: content,
@@ -510,7 +510,7 @@ export const api = {
getAuthFiles: () => request<{ files: AuthFile[] }>('/cliproxy/auth-files'), getAuthFiles: () => request<{ files: AuthFile[] }>('/cliproxy/auth-files'),
getAuthFile: async (name: string): Promise<string> => { getAuthFile: async (name: string): Promise<string> => {
const res = await fetch( const res = await fetch(
`${BASE_URL}/cliproxy/auth-files/download?name=${encodeURIComponent(name)}` withApiBase(`/cliproxy/auth-files/download?name=${encodeURIComponent(name)}`)
); );
if (!res.ok) throw new Error('Failed to load auth file'); if (!res.ok) throw new Error('Failed to load auth file');
return res.text(); return res.text();
@@ -592,7 +592,7 @@ export const api = {
list: () => request<{ files: CliproxyErrorLog[] }>('/cliproxy/error-logs'), list: () => request<{ files: CliproxyErrorLog[] }>('/cliproxy/error-logs'),
/** Get content of a specific error log */ /** Get content of a specific error log */
getContent: async (name: string): Promise<string> => { getContent: async (name: string): Promise<string> => {
const res = await fetch(`${BASE_URL}/cliproxy/error-logs/${encodeURIComponent(name)}`); const res = await fetch(withApiBase(`/cliproxy/error-logs/${encodeURIComponent(name)}`));
if (!res.ok) throw new Error('Failed to load error log'); if (!res.ok) throw new Error('Failed to load error log');
return res.text(); return res.text();
}, },