feat: extend enterprise gateway policies billing protocols and operations

This commit is contained in:
wlx committed 2026-10-13 19:08:50 +08:00
1 parent 1528b71882
commit af43947b5d
67 files changed
+1822 -69

No files matched your search

+1
View File
@@ -22,6 +22,7 @@ export interface RegisterInput {
export interface LoginInput {
account: string
password: string
otp?: string
}
export interface AuthClient {
+7
View File
@@ -0,0 +1,7 @@
export async function enterprise<T = Record<string, unknown>>(path: string, body?: unknown, method = 'PUT'): Promise<T> {
const base = (import.meta.env.VITE_CONTROL_PLANE_URL || '').replace(/\/$/, '')
const response = await fetch(`${base}${path}`, { credentials: 'include', method: body === undefined ? 'GET' : method, headers: { 'Content-Type': 'application/json', 'X-Moyi-Source': path.startsWith('/api/playground/') ? 'playground' : 'console' }, body: body === undefined ? undefined : JSON.stringify(body) })
const data = await response.json().catch(() => ({}))
if (!response.ok) throw new Error(data.error?.message || '操作失败,请稍后重试')
return data as T
}