diff options
Diffstat (limited to 'frontend/src/api/Api.tsx')
| -rw-r--r-- | frontend/src/api/Api.tsx | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/frontend/src/api/Api.tsx b/frontend/src/api/Api.tsx index e62bb22..1f77088 100644 --- a/frontend/src/api/Api.tsx +++ b/frontend/src/api/Api.tsx | |||
| @@ -1,8 +1,8 @@ | |||
| 1 | import axios from 'axios'; | 1 | import axios from 'axios'; |
| 2 | 2 | ||
| 3 | import { Game, GameChapters } from '../types/Game'; | ||
| 4 | import { GameChapter, GamesChapters } from '../types/Chapters'; | 3 | import { GameChapter, GamesChapters } from '../types/Chapters'; |
| 5 | import { MapDiscussion, MapDiscussions, MapLeaderboard, MapSummary, Map } from '../types/Map'; | 4 | import { Game } from '../types/Game'; |
| 5 | import { Map, MapDiscussion, MapDiscussions, MapLeaderboard, MapSummary } from '../types/Map'; | ||
| 6 | import { MapDiscussionCommentContent, MapDiscussionContent, ModMenuContent } from '../types/Content'; | 6 | import { MapDiscussionCommentContent, MapDiscussionContent, ModMenuContent } from '../types/Content'; |
| 7 | import { Search } from '../types/Search'; | 7 | import { Search } from '../types/Search'; |
| 8 | import { UserProfile } from '../types/Profile'; | 8 | import { UserProfile } from '../types/Profile'; |
| @@ -15,11 +15,13 @@ export const API = { | |||
| 15 | 15 | ||
| 16 | get_user: (user_id: string) => get_user(user_id), | 16 | get_user: (user_id: string) => get_user(user_id), |
| 17 | get_games: () => get_games(), | 17 | get_games: () => get_games(), |
| 18 | |||
| 18 | get_chapters: (chapter_id: string) => get_chapters(chapter_id), | 19 | get_chapters: (chapter_id: string) => get_chapters(chapter_id), |
| 19 | get_games_chapters: (game_id: string) => get_games_chapters(game_id), | 20 | get_games_chapters: (game_id: string) => get_games_chapters(game_id), |
| 20 | get_games_maps: (game_id: string) => get_games_maps(game_id), | 21 | get_game_maps: (game_id: string) => get_game_maps(game_id), |
| 21 | get_rankings: () => get_rankings(), | 22 | get_rankings: () => get_rankings(), |
| 22 | get_search: (q: string) => get_search(q), | 23 | get_search: (q: string) => get_search(q), |
| 24 | |||
| 23 | get_map_summary: (map_id: string) => get_map_summary(map_id), | 25 | get_map_summary: (map_id: string) => get_map_summary(map_id), |
| 24 | get_map_leaderboard: (map_id: string) => get_map_leaderboard(map_id), | 26 | get_map_leaderboard: (map_id: string) => get_map_leaderboard(map_id), |
| 25 | get_map_discussions: (map_id: string) => get_map_discussions(map_id), | 27 | get_map_discussions: (map_id: string) => get_map_discussions(map_id), |
| @@ -71,10 +73,11 @@ const get_games_chapters = async (game_id: string): Promise<GamesChapters> => { | |||
| 71 | return response.data.data; | 73 | return response.data.data; |
| 72 | }; | 74 | }; |
| 73 | 75 | ||
| 74 | const get_games_maps = async (game_id: string): Promise<Map> => { | 76 | const get_game_maps = async (game_id: string): Promise<Map[]> => { |
| 75 | const response = await axios.get(url(`games/${game_id}/maps`)) | 77 | const response = await axios.get(url(`games/${game_id}/maps`)) |
| 76 | return response.data.data; | 78 | return response.data.data.maps; |
| 77 | } | 79 | }; |
| 80 | |||
| 78 | 81 | ||
| 79 | // RANKINGS | 82 | // RANKINGS |
| 80 | const get_rankings = async (): Promise<Ranking> => { | 83 | const get_rankings = async (): Promise<Ranking> => { |