diff options
| author | Wolfboy248 <121288977+Wolfboy248@users.noreply.github.com> | 2024-09-06 13:05:39 +0200 |
|---|---|---|
| committer | Wolfboy248 <121288977+Wolfboy248@users.noreply.github.com> | 2024-09-06 13:05:39 +0200 |
| commit | edff87fdf77b32fd03ee26892226068a53fbfaa6 (patch) | |
| tree | de6ed2b1acf0c39421983bebe9737e8a615a950d /frontend/src/api | |
| parent | refactor: maplist page (diff) | |
| download | lphub-edff87fdf77b32fd03ee26892226068a53fbfaa6.tar.gz lphub-edff87fdf77b32fd03ee26892226068a53fbfaa6.tar.bz2 lphub-edff87fdf77b32fd03ee26892226068a53fbfaa6.zip | |
refactor: rankings page
Diffstat (limited to 'frontend/src/api')
| -rw-r--r-- | frontend/src/api/Api.tsx | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/frontend/src/api/Api.tsx b/frontend/src/api/Api.tsx index 326052f..e62bb22 100644 --- a/frontend/src/api/Api.tsx +++ b/frontend/src/api/Api.tsx | |||
| @@ -6,6 +6,7 @@ import { MapDiscussion, MapDiscussions, MapLeaderboard, MapSummary, Map } from ' | |||
| 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'; |
| 9 | import { Ranking } from '../types/Ranking'; | ||
| 9 | 10 | ||
| 10 | // add new api call function entries here | 11 | // add new api call function entries here |
| 11 | // example usage: API.get_games(); | 12 | // example usage: API.get_games(); |
| @@ -17,6 +18,7 @@ export const API = { | |||
| 17 | get_chapters: (chapter_id: string) => get_chapters(chapter_id), | 18 | get_chapters: (chapter_id: string) => get_chapters(chapter_id), |
| 18 | get_games_chapters: (game_id: string) => get_games_chapters(game_id), | 19 | get_games_chapters: (game_id: string) => get_games_chapters(game_id), |
| 19 | get_games_maps: (game_id: string) => get_games_maps(game_id), | 20 | get_games_maps: (game_id: string) => get_games_maps(game_id), |
| 21 | get_rankings: () => get_rankings(), | ||
| 20 | get_search: (q: string) => get_search(q), | 22 | get_search: (q: string) => get_search(q), |
| 21 | get_map_summary: (map_id: string) => get_map_summary(map_id), | 23 | get_map_summary: (map_id: string) => get_map_summary(map_id), |
| 22 | get_map_leaderboard: (map_id: string) => get_map_leaderboard(map_id), | 24 | get_map_leaderboard: (map_id: string) => get_map_leaderboard(map_id), |
| @@ -74,6 +76,12 @@ const get_games_maps = async (game_id: string): Promise<Map> => { | |||
| 74 | return response.data.data; | 76 | return response.data.data; |
| 75 | } | 77 | } |
| 76 | 78 | ||
| 79 | // RANKINGS | ||
| 80 | const get_rankings = async (): Promise<Ranking> => { | ||
| 81 | const response = await axios.get(url(`rankings`)); | ||
| 82 | return response.data.data; | ||
| 83 | } | ||
| 84 | |||
| 77 | // SEARCH | 85 | // SEARCH |
| 78 | 86 | ||
| 79 | const get_search = async (q: string): Promise<Search> => { | 87 | const get_search = async (q: string): Promise<Search> => { |