Generate, list, and cancel attended-support codes (XXX-XXX-XXX), built on the v2 codes API and existing UI primitives. - Codes table: code in mono, status badge (pending+pulse/connected/ completed/cancelled), bound client/machine, created-by, created (relative + absolute tooltip). Sticky header, skeleton load, actionable empty/error states. - Generate opens a focused reveal modal showing the code large in JetBrains Mono with copy and a read-aloud instruction; the code is announced character-by-character for screen readers. Mint is ref- guarded so it creates exactly one code per open (no StrictMode dupe). - Cancel via confirm dialog (POST /api/codes/:code/cancel), disabled for non-cancellable statuses; invalidates the codes query. List polls 7s. - Shared API client now tolerates non-JSON 200 bodies, so the cancel endpoint's plain-text "Code cancelled" success no longer surfaces as a failure. Error-envelope handling unchanged. Passed Code Review (no blockers after fixes) and local gates (tsc/lint/build green). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
19 lines
774 B
TypeScript
19 lines
774 B
TypeScript
// Scaffolds for later passes. These endpoints exist on the server but their
|
|
// views (Sessions, Codes, Users) are out of scope for pass 1. Typed signatures
|
|
// are stubbed here so the API surface is discoverable and future passes can
|
|
// flesh out the response interfaces against the Rust source.
|
|
//
|
|
// Intentionally minimal: do NOT build UI against these yet.
|
|
|
|
import { http } from "./client";
|
|
|
|
/** GET /api/sessions — active/historical sessions. Pass 2. */
|
|
export function listSessions(signal?: AbortSignal): Promise<unknown[]> {
|
|
return http.get<unknown[]>("/api/sessions", signal);
|
|
}
|
|
|
|
/** GET /api/users — dashboard users (admin). Pass 2. */
|
|
export function listUsers(signal?: AbortSignal): Promise<unknown[]> {
|
|
return http.get<unknown[]>("/api/users", signal);
|
|
}
|