aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/api
diff options
context:
space:
mode:
authorWolfboy248 <121288977+Wolfboy248@users.noreply.github.com>2024-09-05 16:48:01 +0200
committerWolfboy248 <121288977+Wolfboy248@users.noreply.github.com>2024-09-05 16:48:01 +0200
commitdea41ea59c558068078c98dd1758cdba2beceda8 (patch)
tree15bd6a8a490bdceb66fa093d2b33c862da81b821 /frontend/src/api
parentrefactor: fix summary cat change logic (diff)
downloadlphub-dea41ea59c558068078c98dd1758cdba2beceda8.tar.gz
lphub-dea41ea59c558068078c98dd1758cdba2beceda8.tar.bz2
lphub-dea41ea59c558068078c98dd1758cdba2beceda8.zip
refactor: maplist page
Diffstat (limited to 'frontend/src/api')
-rw-r--r--frontend/src/api/Api.tsx23
1 files changed, 21 insertions, 2 deletions
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 @@
1import axios from 'axios'; 1import axios from 'axios';
2 2
3import { Game } from '../types/Game'; 3import { Game, GameChapters } from '../types/Game';
4import { MapDiscussion, MapDiscussions, MapLeaderboard, MapSummary } from '../types/Map'; 4import { GameChapter, GamesChapters } from '../types/Chapters';
5import { MapDiscussion, MapDiscussions, MapLeaderboard, MapSummary, Map } from '../types/Map';
5import { MapDiscussionCommentContent, MapDiscussionContent, ModMenuContent } from '../types/Content'; 6import { MapDiscussionCommentContent, MapDiscussionContent, ModMenuContent } from '../types/Content';
6import { Search } from '../types/Search'; 7import { Search } from '../types/Search';
7import { UserProfile } from '../types/Profile'; 8import { UserProfile } from '../types/Profile';
@@ -13,6 +14,9 @@ export const API = {
13 14
14 get_user: (user_id: string) => get_user(user_id), 15 get_user: (user_id: string) => get_user(user_id),
15 get_games: () => get_games(), 16 get_games: () => get_games(),
17 get_chapters: (chapter_id: string) => get_chapters(chapter_id),
18 get_games_chapters: (game_id: string) => get_games_chapters(game_id),
19 get_games_maps: (game_id: string) => get_games_maps(game_id),
16 get_search: (q: string) => get_search(q), 20 get_search: (q: string) => get_search(q),
17 get_map_summary: (map_id: string) => get_map_summary(map_id), 21 get_map_summary: (map_id: string) => get_map_summary(map_id),
18 get_map_leaderboard: (map_id: string) => get_map_leaderboard(map_id), 22 get_map_leaderboard: (map_id: string) => get_map_leaderboard(map_id),
@@ -55,6 +59,21 @@ const get_games = async (): Promise<Game[]> => {
55 return response.data.data; 59 return response.data.data;
56}; 60};
57 61
62const get_chapters = async (chapter_id: string): Promise<GameChapter> => {
63 const response = await axios.get(url(`chapters/${chapter_id}`));
64 return response.data.data;
65}
66
67const get_games_chapters = async (game_id: string): Promise<GamesChapters> => {
68 const response = await axios.get(url(`games/${game_id}`));
69 return response.data.data;
70};
71
72const get_games_maps = async (game_id: string): Promise<Map> => {
73 const response = await axios.get(url(`games/${game_id}/maps`))
74 return response.data.data;
75}
76
58// SEARCH 77// SEARCH
59 78
60const get_search = async (q: string): Promise<Search> => { 79const get_search = async (q: string): Promise<Search> => {