feat(web): 前端逻辑骨架——http/router/stores/queries 与薄壳路由

This commit is contained in:
2026-10-07 14:36:06 +08:00
parent 9ecf817df2
commit fbb989c3fb
39 changed files with 1431 additions and 175 deletions
+29
View File
@@ -0,0 +1,29 @@
import type { KeyItem } from "@new-api-key-usage/core";
import { adminHttp } from "../http.ts";
export type KeyListFilters = {
member_id?: number | "unassigned";
status?: "active" | "disabled";
recent_failed?: boolean;
};
export async function fetchKeys(filters: KeyListFilters = {}): Promise<KeyItem[]> {
const { data } = await adminHttp.get<KeyItem[]>("/keys", { params: filters });
return data;
}
export async function registerKey(body: {
sk_key: string;
member_id?: number | null;
}): Promise<KeyItem> {
const { data } = await adminHttp.post<KeyItem>("/keys", body);
return data;
}
export async function patchKey(
id: number,
body: { status?: "active" | "disabled"; member_id?: number | null },
): Promise<KeyItem> {
const { data } = await adminHttp.patch<KeyItem>(`/keys/${id}`, body);
return data;
}