aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/api/Mod.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/api/Mod.tsx')
-rw-r--r--frontend/src/api/Mod.tsx58
1 files changed, 58 insertions, 0 deletions
diff --git a/frontend/src/api/Mod.tsx b/frontend/src/api/Mod.tsx
new file mode 100644
index 0000000..9091379
--- /dev/null
+++ b/frontend/src/api/Mod.tsx
@@ -0,0 +1,58 @@
1import axios from "axios";
2import { url } from "./Api";
3import { ModMenuContent } from "../types/Content";
4
5export const put_map_image = async (token: string, map_id: string, image: string): Promise<boolean> => {
6 const response = await axios.put(url(`maps/${map_id}/image`), {
7 "image": image,
8 }, {
9 headers: {
10 "Authorization": token,
11 }
12 });
13 return response.data.success;
14};
15
16export const post_map_summary = async (token: string, map_id: string, content: ModMenuContent): Promise<boolean> => {
17 const response = await axios.post(url(`maps/${map_id}/summary`), {
18 "category_id": content.category_id,
19 "user_name": content.name,
20 "score_count": content.score,
21 "record_date": content.date,
22 "showcase": content.showcase,
23 "description": content.description,
24 }, {
25 headers: {
26 "Authorization": token,
27 }
28 });
29 return response.data.success;
30};
31
32export const put_map_summary = async (token: string, map_id: string, content: ModMenuContent): Promise<boolean> => {
33 const response = await axios.put(url(`maps/${map_id}/summary`), {
34 "route_id": content.id,
35 "user_name": content.name,
36 "score_count": content.score,
37 "record_date": content.date,
38 "showcase": content.showcase,
39 "description": content.description,
40 }, {
41 headers: {
42 "Authorization": token,
43 }
44 });
45 return response.data.success;
46};
47
48export const delete_map_summary = async (token: string, map_id: string, route_id: number): Promise<boolean> => {
49 const response = await axios.delete(url(`maps/${map_id}/summary`), {
50 data: {
51 "route_id": route_id,
52 },
53 headers: {
54 "Authorization": token,
55 }
56 });
57 return response.data.success;
58};