- lib/api/{core,auth,chat,sessions,personas,admin,adminChannels,adminSystem}.ts
- api.ts 改纯 barrel 显式 re-export(export type for types, isolatedModules); 导出名 77→77, 36处导入点零改动
- 代码行多重集比对一致(仅 request/limitQuery 各加一 export 供兄弟模块); 每文件≤500/函数≤80
- 前端 build 绿(165 modules)
20 lines
560 B
TypeScript
20 lines
560 B
TypeScript
import type { LoginResult } from "../types";
|
|
import { request } from "./core";
|
|
|
|
/** POST /api/v1/auth/login — exchanges user/password for a JWT. */
|
|
export function login(username: string, password: string): Promise<LoginResult> {
|
|
return request<LoginResult>(
|
|
"/auth/login",
|
|
{
|
|
method: "POST",
|
|
body: JSON.stringify({ username, password }),
|
|
},
|
|
{ skipAuthExpired: true }
|
|
);
|
|
}
|
|
|
|
/** GET /api/v1/health — liveness probe. */
|
|
export function health(): Promise<{ status: string }> {
|
|
return request<{ status: string }>("/health");
|
|
}
|