feat: 在线用户

This commit is contained in:
dap
2024-10-05 13:44:02 +08:00
parent 4ebd4821e2
commit 6e807a3653
4 changed files with 369 additions and 2440 deletions

View File

@@ -1,6 +1,6 @@
import type { OnlineUser } from './model';
import type { PageQuery } from '#/api/common';
import type { PageQuery, PageResult } from '#/api/common';
import { requestClient } from '#/api/request';
@@ -14,11 +14,11 @@ enum Api {
* @returns OnlineUser[]
*/
export function onlineDeviceList() {
return requestClient.get<OnlineUser[]>(Api.root);
return requestClient.get<PageResult<OnlineUser>>(Api.root);
}
export function onlineList(params?: PageQuery) {
return requestClient.get<OnlineUser[]>(Api.onlineList, { params });
return requestClient.get<PageResult<OnlineUser>>(Api.onlineList, { params });
}
/**
@@ -27,7 +27,7 @@ export function onlineList(params?: PageQuery) {
* @returns void
*/
export function forceLogout(tokenId: string) {
return requestClient.delete<void>(`${Api.root}/${tokenId}`);
return requestClient.deleteWithMsg<void>(`${Api.root}/${tokenId}`);
}
/**
@@ -36,5 +36,5 @@ export function forceLogout(tokenId: string) {
* @returns void
*/
export function forceLogout2(tokenId: string) {
return requestClient.post<void>(`${Api.root}/${tokenId}`);
return requestClient.postWithMsg<void>(`${Api.root}/${tokenId}`);
}