refactor(api): 简化 API 路径定义,移除 API_V1_PREFIX
更新多个 API 文件,将 API_V1_PREFIX 替换为直接使用 /admin 路径。 简化 API 路径定义逻辑,提升代码可读性与维护性。 统一后台管理接口的路由配置,确保各管理端 API 端点保持一致性。
This commit is contained in:
@@ -10,7 +10,6 @@ import type {
|
||||
} from "@/types/api/admin-auth";
|
||||
import { adminRequest } from "@/lib/admin-http";
|
||||
|
||||
import { API_V1_PREFIX } from "@/api/paths";
|
||||
|
||||
/** `GET /api/v1/admin/auth/captcha`(无需 Token) */
|
||||
export async function getAdminCaptcha(): Promise<AdminAuthCaptchaResponse | null> {
|
||||
@@ -19,7 +18,7 @@ export async function getAdminCaptcha(): Promise<AdminAuthCaptchaResponse | null
|
||||
}
|
||||
try {
|
||||
return await publicAdminRequest<AdminAuthCaptchaResponse>({
|
||||
url: `${API_V1_PREFIX}/admin/auth/captcha`,
|
||||
url: `/admin/auth/captcha`,
|
||||
method: "GET",
|
||||
});
|
||||
} catch {
|
||||
@@ -32,7 +31,7 @@ export async function postAdminLogin(
|
||||
body: AdminAuthLoginRequest,
|
||||
): Promise<AdminAuthLoginResponse> {
|
||||
return publicAdminRequest<AdminAuthLoginResponse>({
|
||||
url: `${API_V1_PREFIX}/admin/auth/login`,
|
||||
url: `/admin/auth/login`,
|
||||
method: "POST",
|
||||
data: body,
|
||||
});
|
||||
@@ -40,5 +39,5 @@ export async function postAdminLogin(
|
||||
|
||||
/** `GET /api/v1/admin/auth/me`(需 Token) */
|
||||
export async function getAdminMe(): Promise<AdminAuthMeResponse> {
|
||||
return adminRequest.get<AdminAuthMeResponse>(`${API_V1_PREFIX}/admin/auth/me`);
|
||||
return adminRequest.get<AdminAuthMeResponse>(`/admin/auth/me`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user