api client refactor
This commit is contained in:
22
apps/website/lib/services/races/RaceService.ts
Normal file
22
apps/website/lib/services/races/RaceService.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { api as api } from '../../api';
|
||||
import { presentRaceDetail } from '../../presenters';
|
||||
import { RaceDetailViewModel } from '../../view-models';
|
||||
|
||||
export async function getRaceDetail(
|
||||
raceId: string,
|
||||
driverId: string
|
||||
): Promise<RaceDetailViewModel> {
|
||||
const dto = await api.races.getDetail(raceId, driverId);
|
||||
return presentRaceDetail(dto);
|
||||
}
|
||||
|
||||
export async function getRacesPageData(): Promise<any> {
|
||||
const dto = await api.races.getPageData();
|
||||
// TODO: use presenter
|
||||
return dto;
|
||||
}
|
||||
|
||||
export async function getRacesTotal(): Promise<any> {
|
||||
const dto = await api.races.getTotal();
|
||||
return dto;
|
||||
}
|
||||
Reference in New Issue
Block a user