Restore account settings page
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* API Token (Personal Access Token) 管理
|
||||
*/
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ApiTokenApi {
|
||||
export interface TokenItem {
|
||||
id: string;
|
||||
name: string;
|
||||
token_prefix: string;
|
||||
expires_at?: null | string;
|
||||
last_used_at?: null | string;
|
||||
description?: null | string;
|
||||
is_active: boolean;
|
||||
sys_create_datetime?: null | string;
|
||||
}
|
||||
|
||||
export interface CreateTokenRequest {
|
||||
name: string;
|
||||
expires_at?: null | string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export interface CreateTokenResponse {
|
||||
id: string;
|
||||
name: string;
|
||||
token: string;
|
||||
token_prefix: string;
|
||||
expires_at?: null | string;
|
||||
description?: null | string;
|
||||
sys_create_datetime?: null | string;
|
||||
}
|
||||
}
|
||||
|
||||
export async function getApiTokenListApi() {
|
||||
return requestClient.get<ApiTokenApi.TokenItem[]>('/api/core/api-tokens');
|
||||
}
|
||||
|
||||
export async function createApiTokenApi(data: ApiTokenApi.CreateTokenRequest) {
|
||||
return requestClient.post<ApiTokenApi.CreateTokenResponse>(
|
||||
'/api/core/api-tokens',
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
export async function revokeApiTokenApi(tokenId: string) {
|
||||
return requestClient.delete(`/api/core/api-tokens/${tokenId}`);
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
/**
|
||||
* 设备管理 API
|
||||
*/
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace DeviceApi {
|
||||
/** 设备信息 */
|
||||
export interface DeviceInfo {
|
||||
device_id: string;
|
||||
device_name?: string;
|
||||
device_type?: string;
|
||||
browser_type?: string;
|
||||
os_type?: string;
|
||||
ip_address?: string;
|
||||
last_active_time?: string;
|
||||
is_current: boolean;
|
||||
is_online: boolean;
|
||||
}
|
||||
|
||||
/** 设备列表响应 */
|
||||
export interface DeviceListResponse {
|
||||
current_device?: DeviceInfo;
|
||||
online_devices: DeviceInfo[];
|
||||
total_count: number;
|
||||
}
|
||||
|
||||
/** 设备重命名请求 */
|
||||
export interface DeviceRenameRequest {
|
||||
device_name: string;
|
||||
}
|
||||
|
||||
/** 统计信息响应 */
|
||||
export interface StatisticsResponse {
|
||||
online_count: number;
|
||||
total_count: number;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备列表
|
||||
*/
|
||||
export async function getDeviceListApi() {
|
||||
return requestClient.get<DeviceApi.DeviceListResponse>('/api/core/devices');
|
||||
}
|
||||
|
||||
/**
|
||||
* 强制登出指定设备
|
||||
*/
|
||||
export async function logoutDeviceApi(deviceId: string) {
|
||||
return requestClient.delete(`/api/core/devices/${deviceId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 登出其他所有设备
|
||||
*/
|
||||
export async function logoutOtherDevicesApi() {
|
||||
return requestClient.delete('/api/core/devices/logout-others');
|
||||
}
|
||||
|
||||
/**
|
||||
* 重命名设备
|
||||
*/
|
||||
export async function renameDeviceApi(
|
||||
deviceId: string,
|
||||
data: DeviceApi.DeviceRenameRequest,
|
||||
) {
|
||||
return requestClient.post(`/api/core/devices/${deviceId}/rename`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备统计信息
|
||||
*/
|
||||
export async function getDeviceStatisticsApi() {
|
||||
return requestClient.get<DeviceApi.StatisticsResponse>(
|
||||
'/api/core/devices/statistics',
|
||||
);
|
||||
}
|
||||
@@ -1,10 +1,12 @@
|
||||
export * from './announcement';
|
||||
export * from './api-token';
|
||||
export * from './application';
|
||||
export * from './auth';
|
||||
export * from './data-source';
|
||||
export * from './database-connection';
|
||||
export * from './database-manager';
|
||||
export * from './dept';
|
||||
export * from './device';
|
||||
export * from './dict';
|
||||
export * from './file';
|
||||
export * from './field-permission';
|
||||
|
||||
Reference in New Issue
Block a user