Skip to content

Commit

Permalink
#167 Fix rest api and add DTOs
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaszdworniczak committed Apr 15, 2021
1 parent e4b7035 commit 9ea5e32
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import axios from "axios";
import {PATH_BASE_URL} from "../../components/atoms/constants/apiPaths";
import {MatchDetailsDto} from "./MatchDetailsDto";
import {TournamentPlaceListDto} from "./TournamentPlaceListDto";

export type DoublesTournamentRestApiConfig = {
readonly baseUrl: string;
Expand All @@ -22,9 +22,9 @@ export const DoublesTournamentRestAPI = (
defaultConfig.baseUrl,
};
return {
getTournamentResult(tournamentId: string): Promise<MatchDetailsDto> {
getTournamentPlaces(tournamentId: string): Promise<TournamentPlaceListDto> {
return axios
.get<MatchDetailsDto>(`${currentConfig.baseUrl}/doubles-tournament/${tournamentId}/places`)
.get<TournamentPlaceListDto>(`${currentConfig.baseUrl}/doubles-tournament/${tournamentId}/places`)
.then((res) => res.data)
},
};
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/restapi/doubles-tournament/TournamentPlaceDto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export type TournamentPlaceDto = {
readonly tournamentId: string;
readonly placeNumber: number;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import {TournamentPlaceDto} from "./TournamentPlaceDto";

export type TournamentPlaceListDto = {
readonly items: TournamentPlaceDto[];
};

0 comments on commit 9ea5e32

Please sign in to comment.