refactor: 拆分 API Client 资源模块
This commit is contained in:
1 parent
f3adf7bc15
commit
357f271639
24 files changed
+1280
-905
No files matched your search
@@ -0,0 +1,26 @@
|
||||
import type { RequestFn } from "../client/request.js";
|
||||
|
||||
export interface SessionMethods {
|
||||
loginAdmin(
|
||||
username: string,
|
||||
password: string,
|
||||
): Promise<{
|
||||
token: string;
|
||||
displayName: string;
|
||||
mustChangePassword: boolean;
|
||||
role: string;
|
||||
}>;
|
||||
changeAdminPassword(currentPassword: string, newPassword: string): Promise<{ changed: true }>;
|
||||
}
|
||||
|
||||
export function sessionMethods({ request }: { request: RequestFn }): SessionMethods {
|
||||
return {
|
||||
loginAdmin: (username, password) =>
|
||||
request("/admin/session/login", { method: "POST", body: { username, password } }),
|
||||
changeAdminPassword: (currentPassword, newPassword) =>
|
||||
request("/admin/session/change-password", {
|
||||
method: "POST",
|
||||
body: { currentPassword, newPassword },
|
||||
}),
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user