From a7c282ca348c1e8e60559e5c064caee28ba11eec Mon Sep 17 00:00:00 2001
From: Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com>
Date: Wed, 9 Oct 2024 16:34:12 +0300
Subject: refactor: so much shit

---
 frontend/src/api/Mod.tsx | 58 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)
 create mode 100644 frontend/src/api/Mod.tsx

(limited to 'frontend/src/api/Mod.tsx')

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 @@
+import axios from "axios";
+import { url } from "./Api";
+import { ModMenuContent } from "../types/Content";
+
+export const put_map_image = async (token: string, map_id: string, image: string): Promise<boolean> => {
+  const response = await axios.put(url(`maps/${map_id}/image`), {
+    "image": image,
+  }, {
+    headers: {
+      "Authorization": token,
+    }
+  });
+  return response.data.success;
+};
+
+export const post_map_summary = async (token: string, map_id: string, content: ModMenuContent): Promise<boolean> => {
+  const response = await axios.post(url(`maps/${map_id}/summary`), {
+    "category_id": content.category_id,
+    "user_name": content.name,
+    "score_count": content.score,
+    "record_date": content.date,
+    "showcase": content.showcase,
+    "description": content.description,
+  }, {
+    headers: {
+      "Authorization": token,
+    }
+  });
+  return response.data.success;
+};
+
+export const put_map_summary = async (token: string, map_id: string, content: ModMenuContent): Promise<boolean> => {
+  const response = await axios.put(url(`maps/${map_id}/summary`), {
+    "route_id": content.id,
+    "user_name": content.name,
+    "score_count": content.score,
+    "record_date": content.date,
+    "showcase": content.showcase,
+    "description": content.description,
+  }, {
+    headers: {
+      "Authorization": token,
+    }
+  });
+  return response.data.success;
+};
+
+export const delete_map_summary = async (token: string, map_id: string, route_id: number): Promise<boolean> => {
+  const response = await axios.delete(url(`maps/${map_id}/summary`), {
+    data: {
+      "route_id": route_id,
+    },
+    headers: {
+      "Authorization": token,
+    }
+  });
+  return response.data.success;
+};
-- 
cgit v1.2.3

