aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/api/Maps.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/api/Maps.tsx')
-rw-r--r--frontend/src/api/Maps.tsx26
1 files changed, 25 insertions, 1 deletions
diff --git a/frontend/src/api/Maps.tsx b/frontend/src/api/Maps.tsx
index fbad78c..6bdc3e6 100644
--- a/frontend/src/api/Maps.tsx
+++ b/frontend/src/api/Maps.tsx
@@ -1,6 +1,6 @@
1import axios from "axios"; 1import axios from "axios";
2import { url } from "./Api"; 2import { url } from "./Api";
3import { MapDiscussionContent } from "../types/Content"; 3import { MapDiscussionContent, UploadRunContent } from "../types/Content";
4import { MapSummary, MapLeaderboard, MapDiscussions, MapDiscussion } from "../types/Map"; 4import { MapSummary, MapLeaderboard, MapDiscussions, MapDiscussion } from "../types/Map";
5 5
6export const get_map_summary = async (map_id: string): Promise<MapSummary> => { 6export const get_map_summary = async (map_id: string): Promise<MapSummary> => {
@@ -74,3 +74,27 @@ export const delete_map_discussion = async (token: string, map_id: string, discu
74 }); 74 });
75 return response.data.success; 75 return response.data.success;
76}; 76};
77
78export const post_record = async (token: string, run: UploadRunContent): Promise<[string]> => {
79 if (run.partner_demo && run.partner_id) {
80 const response = await axios.postForm(url(`maps/${run.map_id}/record`), {
81 "host_demo": run.host_demo,
82 "partner_demo": run.partner_demo,
83 "partner_id": run.partner_id,
84 }, {
85 headers: {
86 "Authorization": token,
87 }
88 });
89 return response.data.message;
90 } else {
91 const response = await axios.postForm(url(`maps/${run.map_id}/record`), {
92 "host_demo": run.host_demo,
93 }, {
94 headers: {
95 "Authorization": token,
96 }
97 });
98 return response.data.message;
99 }
100};