Files
jiu/client/lib/repositories/session_repository.dart
T
wangjia 90f318e246
Deploy Client / build-windows (push) Failing after 21s
Deploy Client / build-client-web (push) Successful in 42s
Deploy Client / build-macos (push) Successful in 2m8s
Deploy Client / build-android (push) Successful in 1m25s
Deploy Client / build-ios (push) Successful in 2m47s
Deploy Client / release-deploy-client (push) Has been skipped
chore: release client-v1.0.57
设备/状态管理屏(查看本店在线设备/会话,管理员可强制下线)、登录携带设备信息、
会话心跳(/auth/ping)、被踢下线/会话失效提示、顶栏精简 + 用户名移至左侧栏底部。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-17 23:13:05 +08:00

22 lines
674 B
Dart
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import '../core/api/api_client.dart';
import '../models/session.dart';
class SessionRepository {
final ApiClient _client;
SessionRepository(this._client);
/// GET /api/v1/sessions —— 本店在线会话(所有登录用户只读)
Future<List<DeviceSession>> list() async {
final resp = await _client.get('/sessions');
final data = (resp.data['data'] as List?) ?? [];
return data
.map((e) => DeviceSession.fromJson(e as Map<String, dynamic>))
.toList();
}
/// DELETE /api/v1/sessions/:id —— 强制下线(仅 admin/superadmin
Future<void> forceLogout(int id) async {
await _client.delete('/sessions/$id');
}
}