aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/api/Mod.ts
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/api/Mod.ts')
-rw-r--r--frontend/src/api/Mod.ts104
1 files changed, 66 insertions, 38 deletions
diff --git a/frontend/src/api/Mod.ts b/frontend/src/api/Mod.ts
index 1511f8b..69e76c5 100644
--- a/frontend/src/api/Mod.ts
+++ b/frontend/src/api/Mod.ts
@@ -1,58 +1,86 @@
1import axios from "axios"; 1import axios from 'axios';
2import { url } from "@api/Api"; 2import { url } from '@api/Api';
3import { ModMenuContent } from "@customTypes/Content"; 3import { ModMenuContent } from '@customTypes/Content';
4 4
5export const put_map_image = async (token: string, map_id: string, image: string): Promise<boolean> => { 5export const put_map_image = async (
6 const response = await axios.put(url(`maps/${map_id}/image`), { 6 token: string,
7 "image": image, 7 map_id: string,
8 }, { 8 image: string
9 headers: { 9): Promise<boolean> => {
10 "Authorization": token, 10 const response = await axios.put(
11 url(`maps/${map_id}/image`),
12 {
13 image: image,
14 },
15 {
16 headers: {
17 Authorization: token,
18 },
11 } 19 }
12 }); 20 );
13 return response.data.success; 21 return response.data.success;
14}; 22};
15 23
16export const post_map_summary = async (token: string, map_id: string, content: ModMenuContent): Promise<boolean> => { 24export const post_map_summary = async (
17 const response = await axios.post(url(`maps/${map_id}/summary`), { 25 token: string,
18 "category_id": content.category_id, 26 map_id: string,
19 "user_name": content.name, 27 content: ModMenuContent
20 "score_count": content.score, 28): Promise<boolean> => {
21 "record_date": content.date, 29 const response = await axios.post(
22 "showcase": content.showcase, 30 url(`maps/${map_id}/summary`),
23 "description": content.description, 31 {
24 }, { 32 category_id: content.category_id,
25 headers: { 33 user_name: content.name,
26 "Authorization": token, 34 score_count: content.score,
35 record_date: content.date,
36 showcase: content.showcase,
37 description: content.description,
38 },
39 {
40 headers: {
41 Authorization: token,
42 },
27 } 43 }
28 }); 44 );
29 return response.data.success; 45 return response.data.success;
30}; 46};
31 47
32export const put_map_summary = async (token: string, map_id: string, content: ModMenuContent): Promise<boolean> => { 48export const put_map_summary = async (
33 const response = await axios.put(url(`maps/${map_id}/summary`), { 49 token: string,
34 "route_id": content.id, 50 map_id: string,
35 "user_name": content.name, 51 content: ModMenuContent
36 "score_count": content.score, 52): Promise<boolean> => {
37 "record_date": content.date, 53 const response = await axios.put(
38 "showcase": content.showcase, 54 url(`maps/${map_id}/summary`),
39 "description": content.description, 55 {
40 }, { 56 route_id: content.id,
41 headers: { 57 user_name: content.name,
42 "Authorization": token, 58 score_count: content.score,
59 record_date: content.date,
60 showcase: content.showcase,
61 description: content.description,
62 },
63 {
64 headers: {
65 Authorization: token,
66 },
43 } 67 }
44 }); 68 );
45 return response.data.success; 69 return response.data.success;
46}; 70};
47 71
48export const delete_map_summary = async (token: string, map_id: string, route_id: number): Promise<boolean> => { 72export const delete_map_summary = async (
73 token: string,
74 map_id: string,
75 route_id: number
76): Promise<boolean> => {
49 const response = await axios.delete(url(`maps/${map_id}/summary`), { 77 const response = await axios.delete(url(`maps/${map_id}/summary`), {
50 data: { 78 data: {
51 "route_id": route_id, 79 route_id: route_id,
52 }, 80 },
53 headers: { 81 headers: {
54 "Authorization": token, 82 Authorization: token,
55 } 83 },
56 }); 84 });
57 return response.data.success; 85 return response.data.success;
58}; 86};