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/Games.ts | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 frontend/src/api/Games.ts (limited to 'frontend/src/api/Games.ts') diff --git a/frontend/src/api/Games.ts b/frontend/src/api/Games.ts new file mode 100644 index 0000000..72bb4b3 --- /dev/null +++ b/frontend/src/api/Games.ts @@ -0,0 +1,31 @@ +import axios from "axios"; +import { url } from "@api/Api"; +import { GameChapter, GamesChapters } from "@customTypes/Chapters"; +import { Game } from "@customTypes/Game"; +import { Map } from "@customTypes/Map"; +import { Search } from "@customTypes/Search"; + +export const get_games = async (): Promise => { + const response = await axios.get(url(`games`)) + return response.data.data; +}; + +export const get_chapters = async (chapter_id: string): Promise => { + const response = await axios.get(url(`chapters/${chapter_id}`)); + return response.data.data; +} + +export const get_games_chapters = async (game_id: string): Promise => { + const response = await axios.get(url(`games/${game_id}`)); + return response.data.data; +}; + +export const get_game_maps = async (game_id: string): Promise => { + const response = await axios.get(url(`games/${game_id}/maps`)) + return response.data.data.maps; +}; + +export const get_search = async (q: string): Promise => { + const response = await axios.get(url(`search?q=${q}`)) + return response.data.data; +}; -- cgit v1.2.3