更新多个 API 文件,将 API_V1_PREFIX 替换为直接使用 /admin 路径。 简化 API 路径定义逻辑,提升代码可读性与维护性。 统一后台管理接口的路由配置,确保各管理端 API 端点保持一致性。
18 lines
455 B
TypeScript
18 lines
455 B
TypeScript
import { adminRequest, hasLotteryAdminApiBaseUrl } from "@/lib/admin-http";
|
||
import type { AdminPingResponse } from "@/types/api/admin-ping";
|
||
|
||
|
||
/** `GET /api/v1/admin/ping`(需 Bearer Token) */
|
||
export async function getAdminPing(): Promise<AdminPingResponse | null> {
|
||
if (!hasLotteryAdminApiBaseUrl()) {
|
||
return null;
|
||
}
|
||
try {
|
||
return await adminRequest.get<AdminPingResponse>(
|
||
`/admin/ping`,
|
||
);
|
||
} catch {
|
||
return null;
|
||
}
|
||
}
|