refactor(frontend): remove quota UI and preserve queue lifecycle
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { z } from "zod";
|
||||
|
||||
import { accountSchema, configSchema, recordSchema, reportsSchema, toolsEnvelopeSchema } from "./contracts";
|
||||
import { configSchema, recordSchema, reportsSchema, toolsEnvelopeSchema } from "./contracts";
|
||||
|
||||
export class ApiError extends Error {
|
||||
readonly status: number;
|
||||
@@ -40,7 +40,7 @@ export async function optionalRequest<T>(path: string, schema: z.ZodType<T>, sig
|
||||
if (signal.aborted) {
|
||||
throw error;
|
||||
}
|
||||
// Profile, reports, and account features are optional in generic deployments.
|
||||
// Profile and reports are optional in generic deployments.
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -48,9 +48,6 @@ export async function optionalRequest<T>(path: string, schema: z.ZodType<T>, sig
|
||||
export function getConfig(signal: AbortSignal) {
|
||||
return request("/api/config", configSchema, { signal });
|
||||
}
|
||||
export function getAccount(signal: AbortSignal) {
|
||||
return optionalRequest("/api/me", accountSchema, signal);
|
||||
}
|
||||
export async function getProfile(phone: string, signal: AbortSignal) {
|
||||
if (!phone) {
|
||||
return null;
|
||||
@@ -89,8 +86,9 @@ export const searchSchema = z.object({
|
||||
});
|
||||
|
||||
/** Teardown must survive pagehide and must not hold up a new session. */
|
||||
export function endReservation(path: "/api/session/end" | "/api/queue/end", body: Record<string, string>) {
|
||||
const payload = JSON.stringify(body);
|
||||
export function cancelQueue(queueId: string) {
|
||||
const path = "/api/queue/end";
|
||||
const payload = JSON.stringify({ queueId });
|
||||
if (
|
||||
typeof navigator.sendBeacon === "function" &&
|
||||
navigator.sendBeacon(path, new Blob([payload], { type: "application/json" }))
|
||||
|
||||
Reference in New Issue
Block a user