From dea41ea59c558068078c98dd1758cdba2beceda8 Mon Sep 17 00:00:00 2001
From: Wolfboy248 <121288977+Wolfboy248@users.noreply.github.com>
Date: Thu, 5 Sep 2024 16:48:01 +0200
Subject: refactor: maplist page

---
 frontend/src/api/Api.tsx | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

(limited to 'frontend/src/api/Api.tsx')

diff --git a/frontend/src/api/Api.tsx b/frontend/src/api/Api.tsx
index 9e45bc4..326052f 100644
--- a/frontend/src/api/Api.tsx
+++ b/frontend/src/api/Api.tsx
@@ -1,7 +1,8 @@
 import axios from 'axios';
 
-import { Game } from '../types/Game';
-import { MapDiscussion, MapDiscussions, MapLeaderboard, MapSummary } from '../types/Map';
+import { Game, GameChapters } from '../types/Game';
+import { GameChapter, GamesChapters } from '../types/Chapters';
+import { MapDiscussion, MapDiscussions, MapLeaderboard, MapSummary, Map } from '../types/Map';
 import { MapDiscussionCommentContent, MapDiscussionContent, ModMenuContent } from '../types/Content';
 import { Search } from '../types/Search';
 import { UserProfile } from '../types/Profile';
@@ -13,6 +14,9 @@ export const API = {
 
   get_user: (user_id: string) => get_user(user_id),
   get_games: () => get_games(),
+  get_chapters: (chapter_id: string) => get_chapters(chapter_id),
+  get_games_chapters: (game_id: string) => get_games_chapters(game_id),
+  get_games_maps: (game_id: string) => get_games_maps(game_id),
   get_search: (q: string) => get_search(q),
   get_map_summary: (map_id: string) => get_map_summary(map_id),
   get_map_leaderboard: (map_id: string) => get_map_leaderboard(map_id),
@@ -55,6 +59,21 @@ const get_games = async (): Promise<Game[]> => {
   return response.data.data;
 };
 
+const get_chapters = async (chapter_id: string): Promise<GameChapter> => {
+  const response = await axios.get(url(`chapters/${chapter_id}`));
+  return response.data.data;
+}
+
+const get_games_chapters = async (game_id: string): Promise<GamesChapters> => {
+  const response = await axios.get(url(`games/${game_id}`));
+  return response.data.data;
+};
+
+const get_games_maps = async (game_id: string): Promise<Map> => {
+  const response = await axios.get(url(`games/${game_id}/maps`))
+  return response.data.data;
+}
+
 // SEARCH
 
 const get_search = async (q: string): Promise<Search> => {
-- 
cgit v1.2.3

