diff options
| author | Wolfboy248 <georgejvindkarlsen@gmail.com> | 2024-10-18 17:01:01 +0200 |
|---|---|---|
| committer | Wolfboy248 <georgejvindkarlsen@gmail.com> | 2024-10-18 17:01:01 +0200 |
| commit | d9974ede3b3914377beb4b07d78885c48bd74aac (patch) | |
| tree | 6ee6d0adfe62d3ec00dea21dc520dfa09eeaf005 /frontend/src/api | |
| parent | refactor: upload run logic improvement (diff) | |
| download | lphub-d9974ede3b3914377beb4b07d78885c48bd74aac.tar.gz lphub-d9974ede3b3914377beb4b07d78885c48bd74aac.tar.bz2 lphub-d9974ede3b3914377beb4b07d78885c48bd74aac.zip | |
refactor: delete run on profile
Diffstat (limited to 'frontend/src/api')
| -rw-r--r-- | frontend/src/api/Api.tsx | 6 | ||||
| -rw-r--r-- | frontend/src/api/Maps.tsx | 9 |
2 files changed, 13 insertions, 2 deletions
diff --git a/frontend/src/api/Api.tsx b/frontend/src/api/Api.tsx index 0f0c4d3..d03d0ec 100644 --- a/frontend/src/api/Api.tsx +++ b/frontend/src/api/Api.tsx | |||
| @@ -3,7 +3,7 @@ import { delete_token, get_token } from './Auth'; | |||
| 3 | import { get_user, get_profile, post_profile } from './User'; | 3 | import { get_user, get_profile, post_profile } from './User'; |
| 4 | import { get_games, get_chapters, get_games_chapters, get_game_maps, get_search } from './Games'; | 4 | import { get_games, get_chapters, get_games_chapters, get_game_maps, get_search } from './Games'; |
| 5 | import { get_official_rankings, get_unofficial_rankings } from './Rankings'; | 5 | import { get_official_rankings, get_unofficial_rankings } from './Rankings'; |
| 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 } from './Maps'; | 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 './Maps'; |
| 7 | import { delete_map_summary, post_map_summary, put_map_image, put_map_summary } from './Mod'; | 7 | import { delete_map_summary, post_map_summary, put_map_image, put_map_summary } from './Mod'; |
| 8 | import { UploadRunContent } from '../types/Content'; | 8 | import { UploadRunContent } from '../types/Content'; |
| 9 | 9 | ||
| @@ -38,6 +38,8 @@ export const API = { | |||
| 38 | post_record: (token: string, run: UploadRunContent) => post_record(token, run), | 38 | post_record: (token: string, run: UploadRunContent) => post_record(token, run), |
| 39 | 39 | ||
| 40 | delete_map_discussion: (token: string, map_id: string, discussion_id: number) => delete_map_discussion(token, map_id, discussion_id), | 40 | delete_map_discussion: (token: string, map_id: string, discussion_id: number) => delete_map_discussion(token, map_id, discussion_id), |
| 41 | |||
| 42 | delete_map_record: (token: string, map_id: number, record_id: number) => delete_map_record(token, map_id, record_id), | ||
| 41 | // Mod | 43 | // Mod |
| 42 | post_map_summary: (token: string, map_id: string, content: ModMenuContent) => post_map_summary(token, map_id, content), | 44 | post_map_summary: (token: string, map_id: string, content: ModMenuContent) => post_map_summary(token, map_id, content), |
| 43 | 45 | ||
| @@ -47,7 +49,7 @@ export const API = { | |||
| 47 | delete_map_summary: (token: string, map_id: string, route_id: number) => delete_map_summary(token, map_id, route_id), | 49 | delete_map_summary: (token: string, map_id: string, route_id: number) => delete_map_summary(token, map_id, route_id), |
| 48 | }; | 50 | }; |
| 49 | 51 | ||
| 50 | const BASE_API_URL: string = "/api/v1/" | 52 | const BASE_API_URL: string = "https://lp.ardapektezol.com/api/v1/" |
| 51 | 53 | ||
| 52 | export function url(path: string): string { | 54 | export function url(path: string): string { |
| 53 | return BASE_API_URL + path; | 55 | return BASE_API_URL + path; |
diff --git a/frontend/src/api/Maps.tsx b/frontend/src/api/Maps.tsx index 6bdc3e6..8295cf2 100644 --- a/frontend/src/api/Maps.tsx +++ b/frontend/src/api/Maps.tsx | |||
| @@ -97,4 +97,13 @@ export const post_record = async (token: string, run: UploadRunContent): Promise | |||
| 97 | }); | 97 | }); |
| 98 | return response.data.message; | 98 | return response.data.message; |
| 99 | } | 99 | } |
| 100 | } | ||
| 101 | |||
| 102 | export const delete_map_record = async (token: string, map_id: number, record_id: number): Promise<boolean> => { | ||
| 103 | const response = await axios.delete(url(`maps/${map_id}/record/${record_id}`), { | ||
| 104 | headers: { | ||
| 105 | "Authorization": token, | ||
| 106 | } | ||
| 107 | }); | ||
| 108 | return response.data.success; | ||
| 100 | }; | 109 | }; |