diff options
| author | FifthWit <fifthwitbusiness@gmail.com> | 2025-01-30 10:38:30 -0600 |
|---|---|---|
| committer | FifthWit <fifthwitbusiness@gmail.com> | 2025-01-30 10:38:30 -0600 |
| commit | e703025be6065aaa68ed70cf3d4035a3e0175c45 (patch) | |
| tree | ac237fd967c01fbf1e272b7b4158a489e13a1957 /frontend/src/api | |
| parent | removed unused var along with adding proper type to post_profile() (diff) | |
| download | lphub-e703025be6065aaa68ed70cf3d4035a3e0175c45.tar.gz lphub-e703025be6065aaa68ed70cf3d4035a3e0175c45.tar.bz2 lphub-e703025be6065aaa68ed70cf3d4035a3e0175c45.zip | |
unused var
Diffstat (limited to '')
| -rw-r--r-- | frontend/src/api/Api.ts | 90 |
1 files changed, 66 insertions, 24 deletions
diff --git a/frontend/src/api/Api.ts b/frontend/src/api/Api.ts index 862e688..0e1658c 100644 --- a/frontend/src/api/Api.ts +++ b/frontend/src/api/Api.ts | |||
| @@ -1,18 +1,39 @@ | |||
| 1 | import { MapDiscussionCommentContent, MapDiscussionContent, ModMenuContent } from '@customTypes/Content'; | 1 | import { MapDiscussionContent, ModMenuContent } from "@customTypes/Content"; |
| 2 | import { delete_token, get_token } from '@api/Auth'; | 2 | import { delete_token, get_token } from "@api/Auth"; |
| 3 | import { get_user, get_profile, post_profile } from '@api/User'; | 3 | import { get_user, get_profile, post_profile } from "@api/User"; |
| 4 | import { get_games, get_chapters, get_games_chapters, get_game_maps, get_search } from '@api/Games'; | 4 | import { |
| 5 | import { get_official_rankings, get_unofficial_rankings } from '@api/Rankings'; | 5 | get_games, |
| 6 | import { get_map_summary, get_map_leaderboard, get_map_discussions, get_map_discussion, post_map_discussion, post_map_discussion_comment, delete_map_discussion, post_record, delete_map_record } from '@api/Maps'; | 6 | get_chapters, |
| 7 | import { delete_map_summary, post_map_summary, put_map_image, put_map_summary } from '@api/Mod'; | 7 | get_games_chapters, |
| 8 | import { UploadRunContent } from '@customTypes/Content'; | 8 | get_game_maps, |
| 9 | get_search, | ||
| 10 | } from "@api/Games"; | ||
| 11 | import { get_official_rankings, get_unofficial_rankings } from "@api/Rankings"; | ||
| 12 | import { | ||
| 13 | get_map_summary, | ||
| 14 | get_map_leaderboard, | ||
| 15 | get_map_discussions, | ||
| 16 | get_map_discussion, | ||
| 17 | post_map_discussion, | ||
| 18 | post_map_discussion_comment, | ||
| 19 | delete_map_discussion, | ||
| 20 | post_record, | ||
| 21 | delete_map_record, | ||
| 22 | } from "@api/Maps"; | ||
| 23 | import { | ||
| 24 | delete_map_summary, | ||
| 25 | post_map_summary, | ||
| 26 | put_map_image, | ||
| 27 | put_map_summary, | ||
| 28 | } from "@api/Mod"; | ||
| 29 | import { UploadRunContent } from "@customTypes/Content"; | ||
| 9 | 30 | ||
| 10 | // add new api call function entries here | 31 | // add new api call function entries here |
| 11 | // example usage: API.get_games(); | 32 | // example usage: API.get_games(); |
| 12 | export const API = { | 33 | export const API = { |
| 13 | // Auth | 34 | // Auth |
| 14 | get_token: () => get_token(), | 35 | get_token: () => get_token(), |
| 15 | 36 | ||
| 16 | delete_token: () => delete_token(), | 37 | delete_token: () => delete_token(), |
| 17 | // User | 38 | // User |
| 18 | get_user: (user_id: string) => get_user(user_id), | 39 | get_user: (user_id: string) => get_user(user_id), |
| @@ -29,28 +50,49 @@ export const API = { | |||
| 29 | get_unofficial_rankings: () => get_unofficial_rankings(), | 50 | get_unofficial_rankings: () => get_unofficial_rankings(), |
| 30 | // Maps | 51 | // Maps |
| 31 | get_map_summary: (map_id: string) => get_map_summary(map_id), | 52 | get_map_summary: (map_id: string) => get_map_summary(map_id), |
| 32 | get_map_leaderboard: (map_id: string, page: string) => get_map_leaderboard(map_id, page), | 53 | get_map_leaderboard: (map_id: string, page: string) => |
| 54 | get_map_leaderboard(map_id, page), | ||
| 33 | get_map_discussions: (map_id: string) => get_map_discussions(map_id), | 55 | get_map_discussions: (map_id: string) => get_map_discussions(map_id), |
| 34 | get_map_discussion: (map_id: string, discussion_id: number) => get_map_discussion(map_id, discussion_id), | 56 | get_map_discussion: (map_id: string, discussion_id: number) => |
| 57 | get_map_discussion(map_id, discussion_id), | ||
| 35 | 58 | ||
| 36 | post_map_discussion: (token: string, map_id: string, content: MapDiscussionContent) => post_map_discussion(token, map_id, content), | 59 | post_map_discussion: ( |
| 37 | post_map_discussion_comment: (token: string, map_id: string, discussion_id: number, comment: string) => post_map_discussion_comment(token, map_id, discussion_id, comment), | 60 | token: string, |
| 38 | post_record: (token: string, run: UploadRunContent, map_id: number) => post_record(token, run, map_id), | 61 | map_id: string, |
| 62 | content: MapDiscussionContent | ||
| 63 | ) => post_map_discussion(token, map_id, content), | ||
| 64 | post_map_discussion_comment: ( | ||
| 65 | token: string, | ||
| 66 | map_id: string, | ||
| 67 | discussion_id: number, | ||
| 68 | comment: string | ||
| 69 | ) => post_map_discussion_comment(token, map_id, discussion_id, comment), | ||
| 70 | post_record: (token: string, run: UploadRunContent, map_id: number) => | ||
| 71 | post_record(token, run, map_id), | ||
| 39 | 72 | ||
| 40 | delete_map_discussion: (token: string, map_id: string, discussion_id: number) => delete_map_discussion(token, map_id, discussion_id), | 73 | delete_map_discussion: ( |
| 74 | token: string, | ||
| 75 | map_id: string, | ||
| 76 | discussion_id: number | ||
| 77 | ) => delete_map_discussion(token, map_id, discussion_id), | ||
| 41 | 78 | ||
| 42 | delete_map_record: (token: string, map_id: number, record_id: number) => delete_map_record(token, map_id, record_id), | 79 | delete_map_record: (token: string, map_id: number, record_id: number) => |
| 80 | delete_map_record(token, map_id, record_id), | ||
| 43 | // Mod | 81 | // Mod |
| 44 | post_map_summary: (token: string, map_id: string, content: ModMenuContent) => post_map_summary(token, map_id, content), | 82 | post_map_summary: (token: string, map_id: string, content: ModMenuContent) => |
| 45 | 83 | post_map_summary(token, map_id, content), | |
| 46 | put_map_image: (token: string, map_id: string, image: string) => put_map_image(token, map_id, image), | 84 | |
| 47 | put_map_summary: (token: string, map_id: string, content: ModMenuContent) => put_map_summary(token, map_id, content), | 85 | put_map_image: (token: string, map_id: string, image: string) => |
| 48 | 86 | put_map_image(token, map_id, image), | |
| 49 | delete_map_summary: (token: string, map_id: string, route_id: number) => delete_map_summary(token, map_id, route_id), | 87 | put_map_summary: (token: string, map_id: string, content: ModMenuContent) => |
| 88 | put_map_summary(token, map_id, content), | ||
| 89 | |||
| 90 | delete_map_summary: (token: string, map_id: string, route_id: number) => | ||
| 91 | delete_map_summary(token, map_id, route_id), | ||
| 50 | }; | 92 | }; |
| 51 | 93 | ||
| 52 | const BASE_API_URL: string = "/api/v1/" | 94 | const BASE_API_URL: string = "/api/v1/"; |
| 53 | 95 | ||
| 54 | export function url(path: string): string { | 96 | export function url(path: string): string { |
| 55 | return BASE_API_URL + path; | 97 | return BASE_API_URL + path; |
| 56 | }; | 98 | } |