From eae19bb1b047b3568e7a9a624b50e80886e56331 Mon Sep 17 00:00:00 2001 From: Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> Date: Mon, 4 Nov 2024 13:47:50 +0300 Subject: feat/frontend: optimizing imports, file extensions (#230) Co-authored-by: FifthWit --- frontend/src/api/Mod.ts | 58 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 frontend/src/api/Mod.ts (limited to 'frontend/src/api/Mod.ts') diff --git a/frontend/src/api/Mod.ts b/frontend/src/api/Mod.ts new file mode 100644 index 0000000..1511f8b --- /dev/null +++ b/frontend/src/api/Mod.ts @@ -0,0 +1,58 @@ +import axios from "axios"; +import { url } from "@api/Api"; +import { ModMenuContent } from "@customTypes/Content"; + +export const put_map_image = async (token: string, map_id: string, image: string): Promise => { + 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 => { + 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 => { + 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 => { + 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