- 统一token存取逻辑,封装getToken/setToken/removeToken方法 -优化设备ID获取逻辑,调整API路径 - 完善设备管理接口类型定义,增强类型安全 - 调整SSE连接逻辑,使用统一配置管理- 重构HTTP客户端,集中管理后端服务配置 - 更新认证相关API接口,完善请求/响应类型 - 优化设备列表展示逻辑,移除冗余字段 - 调整图片代理路径,统一API前缀 - 完善用户反馈列表展示功能,增强交互体验 - 移除冗余的错误处理逻辑,简化代码结构
37 lines
864 B
TypeScript
37 lines
864 B
TypeScript
import { http } from './http'
|
|
|
|
export interface DeviceItem {
|
|
deviceId: string
|
|
name?: string
|
|
os?: string
|
|
status: 'online' | 'offline'
|
|
lastActiveAt?: string
|
|
isCurrent?: boolean
|
|
}
|
|
|
|
export interface DeviceQuota {
|
|
limit: number
|
|
used: number
|
|
}
|
|
|
|
export const deviceApi = {
|
|
getQuota(username: string) {
|
|
return http.get<{ data: DeviceQuota }>('/monitor/device/quota', { username })
|
|
},
|
|
|
|
list(username: string) {
|
|
return http.get<{ data: DeviceItem[] }>('/monitor/device/list', { username })
|
|
},
|
|
|
|
register(payload: { username: string; deviceId: string; os?: string }) {
|
|
return http.post('/monitor/device/register', payload)
|
|
},
|
|
|
|
remove(payload: { deviceId: string }) {
|
|
return http.post('/monitor/device/remove', payload)
|
|
},
|
|
|
|
offline(payload: { deviceId: string }) {
|
|
return http.post('/monitor/device/offline', payload)
|
|
}
|
|
} |