refactor(frontend): P0 API 层收口与 http 统一
- 统一 http.ts baseURL:get/post/download/upload 均走 resolveApiUrl - agentUtils 下沉至 lib/agent-utils,API 层移除对 components 的依赖 - 扩展 metricsApi/snmpApi/prometheusProxyApi/zabbixProxyApi - 扩展 pipelineApi/credentialApi 覆盖流水线与凭证场景 - 14 个组件/页面禁止直连 http,统一走 @/services/api
This commit is contained in:
1 parent
bfd6431b9d
commit
7fb2236b4d
27 files changed
+194
-150
No files matched your search
@@ -25,7 +25,7 @@ import {
|
||||
SelectValue,
|
||||
} from '@/components/ui/select';
|
||||
import { Server, ChevronDown, Loader2, Save, Key, Shield } from 'lucide-react';
|
||||
import http from '@/services/http';
|
||||
import { credentialApi } from '@/services/api';
|
||||
|
||||
// 表单数据结构
|
||||
export interface ServerFormData {
|
||||
@@ -101,9 +101,9 @@ export function ServerForm({
|
||||
// 加载凭证列表
|
||||
useEffect(() => {
|
||||
if (open) {
|
||||
http.get('/credentials')
|
||||
credentialApi.list()
|
||||
.then(( res: any) => {
|
||||
const list = Array.isArray(res) ? res : (res?.data || []);
|
||||
const list = Array.isArray(res) ? res : (res?.list || res?.data || []);
|
||||
setCredentials(list);
|
||||
})
|
||||
.catch(() => setCredentials([]));
|
||||
|
||||
Reference in new issue
Block a user