Update project 9 FRONT TICKET QR

This commit is contained in:
2026-03-06 15:13:41 +00:00
parent 09609e1d4b
commit 1d709b1dd0
6 changed files with 547 additions and 1 deletions

View File

@@ -14,6 +14,45 @@ apiClient.interceptors.request.use((config) => {
return config;
});
// ─── Domain types (mirror backend schemas) ────────────────────────────────────
export interface TournamentInfo {
id: number;
title: string;
event_date: string; // ISO-8601
}
export interface SeatInfo {
id: number;
sector: string;
row: number;
number: number;
price: number;
tournament: TournamentInfo;
}
export type TicketStatus = "AVAILABLE" | "LOCKED" | "PAID" | "SCANNED" | "REFUNDED";
export interface TicketResponse {
id: number;
status: TicketStatus;
pdf_url: string | null;
created_at: string; // ISO-8601
seat: SeatInfo;
}
// ─── Tickets API ──────────────────────────────────────────────────────────────
/**
* GET /api/tickets/me
* Returns all PAID tickets for the authenticated user.
* Throws AxiosError 401 if the token is missing or expired.
*/
export async function getMyTicketsApi(): Promise<TicketResponse[]> {
const response = await apiClient.get<TicketResponse[]>("/tickets/me");
return response.data;
}
// ─── Seat locking ─────────────────────────────────────────────────────────────
interface LockSeatResponse {