feat(监控): 完善系统监控、登录状态与访问审计能力
This commit is contained in:
@@ -33,6 +33,11 @@ export type LoginKeyResponse = {
|
||||
expires_at: string;
|
||||
};
|
||||
|
||||
export type SessionHeartbeatResponse = {
|
||||
status: "online";
|
||||
last_seen_at: string;
|
||||
};
|
||||
|
||||
export type EncryptedPasswordRequest = {
|
||||
key_id: string;
|
||||
challenge: string;
|
||||
@@ -53,4 +58,18 @@ export const extendToken = (token: string): Promise<AxiosResponse<ExtendResponse
|
||||
export const getLoginKey = (): Promise<AxiosResponse<LoginKeyResponse>> =>
|
||||
authClient.get<LoginKeyResponse>("/api/v1/auth/login-key");
|
||||
|
||||
export const heartbeatSession = (token: string): Promise<AxiosResponse<SessionHeartbeatResponse>> =>
|
||||
authClient.post<SessionHeartbeatResponse>(
|
||||
"/api/v1/auth/session/heartbeat",
|
||||
{},
|
||||
{ headers: { Authorization: `Bearer ${token}` }, timeout: 5000 },
|
||||
);
|
||||
|
||||
export const logoutSession = (token: string): Promise<AxiosResponse<void>> =>
|
||||
authClient.post<void>(
|
||||
"/api/v1/auth/session/logout",
|
||||
{},
|
||||
{ headers: { Authorization: `Bearer ${token}` } },
|
||||
);
|
||||
|
||||
export default authClient;
|
||||
|
||||
Reference in New Issue
Block a user