refactor page to use services

This commit is contained in:
2025-12-18 15:58:09 +01:00
parent f54fa5de5b
commit fc386db06a
45 changed files with 2254 additions and 1292 deletions

View File

@@ -0,0 +1,33 @@
import { BaseApiClient } from '../base/BaseApiClient';
import type {
LeagueAdminProtestsDTO,
ApplyPenaltyCommandDTO,
RequestProtestDefenseCommandDTO,
} from '../../types';
/**
* Protests API Client
*
* Handles all protest-related API operations.
*/
export class ProtestsApiClient extends BaseApiClient {
/** Get protests for a league */
getLeagueProtests(leagueId: string): Promise<LeagueAdminProtestsDTO> {
return this.get<LeagueAdminProtestsDTO>(`/leagues/${leagueId}/protests`);
}
/** Get a specific protest for a league */
getLeagueProtest(leagueId: string, protestId: string): Promise<LeagueAdminProtestsDTO> {
return this.get<LeagueAdminProtestsDTO>(`/leagues/${leagueId}/protests/${protestId}`);
}
/** Apply a penalty */
applyPenalty(input: ApplyPenaltyCommandDTO): Promise<void> {
return this.post<void>('/races/penalties/apply', input);
}
/** Request protest defense */
requestDefense(input: RequestProtestDefenseCommandDTO): Promise<void> {
return this.post<void>('/races/protests/defense/request', input);
}
}