api client refactor
This commit is contained in:
23
apps/website/lib/services/races/RaceResultsService.ts
Normal file
23
apps/website/lib/services/races/RaceResultsService.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { api as api } from '../../api';
|
||||
import { presentRaceResultsDetail } from '../../presenters';
|
||||
import { RaceResultsDetailViewModel } from '../../view-models';
|
||||
|
||||
export async function getRaceResults(
|
||||
raceId: string,
|
||||
currentUserId?: string
|
||||
): Promise<RaceResultsDetailViewModel> {
|
||||
const dto = await api.races.getResultsDetail(raceId);
|
||||
return presentRaceResultsDetail(dto, currentUserId);
|
||||
}
|
||||
|
||||
export async function getRaceSOF(raceId: string): Promise<any> {
|
||||
const dto = await api.races.getWithSOF(raceId);
|
||||
// TODO: use presenter
|
||||
return dto;
|
||||
}
|
||||
|
||||
export async function importRaceResults(raceId: string, input: any): Promise<any> {
|
||||
const dto = await api.races.importResults(raceId, input);
|
||||
// TODO: use presenter
|
||||
return dto;
|
||||
}
|
||||
Reference in New Issue
Block a user