aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/api
diff options
context:
space:
mode:
authorArda Serdar Pektezol <1669855+pektezol@users.noreply.github.com>2024-09-09 19:29:42 +0300
committerArda Serdar Pektezol <1669855+pektezol@users.noreply.github.com>2024-09-09 19:29:42 +0300
commit89560a61bc6e41d86acaea596762eda2da38fe50 (patch)
tree1cf4b7c73c17f045d3f4837b480ddf7a61230a94 /frontend/src/api
parentrefactor: rankings page (diff)
downloadlphub-89560a61bc6e41d86acaea596762eda2da38fe50.tar.gz
lphub-89560a61bc6e41d86acaea596762eda2da38fe50.tar.bz2
lphub-89560a61bc6e41d86acaea596762eda2da38fe50.zip
refactor: upload run form, lots of random shit
Diffstat (limited to 'frontend/src/api')
-rw-r--r--frontend/src/api/Api.tsx15
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 @@
1import axios from 'axios'; 1import axios from 'axios';
2 2
3import { Game, GameChapters } from '../types/Game';
4import { GameChapter, GamesChapters } from '../types/Chapters'; 3import { GameChapter, GamesChapters } from '../types/Chapters';
5import { MapDiscussion, MapDiscussions, MapLeaderboard, MapSummary, Map } from '../types/Map'; 4import { Game } from '../types/Game';
5import { Map, MapDiscussion, MapDiscussions, MapLeaderboard, MapSummary } from '../types/Map';
6import { MapDiscussionCommentContent, MapDiscussionContent, ModMenuContent } from '../types/Content'; 6import { MapDiscussionCommentContent, MapDiscussionContent, ModMenuContent } from '../types/Content';
7import { Search } from '../types/Search'; 7import { Search } from '../types/Search';
8import { UserProfile } from '../types/Profile'; 8import { 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
74const get_games_maps = async (game_id: string): Promise<Map> => { 76const 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
80const get_rankings = async (): Promise<Ranking> => { 83const get_rankings = async (): Promise<Ranking> => {