aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/api/Games.ts
diff options
context:
space:
mode:
authorFifthWit <fifthwitbusiness@gmail.com>2025-01-30 10:44:30 -0600
committerFifthWit <fifthwitbusiness@gmail.com>2025-01-30 10:44:30 -0600
commite40f07211f5f15dcb138e2520a76d13afd3c0cfd (patch)
tree46bad6a17e66d55a4a65088c0b6eb8c48641615a /frontend/src/api/Games.ts
parentadded prettier for more consistency (diff)
downloadlphub-e40f07211f5f15dcb138e2520a76d13afd3c0cfd.tar.gz
lphub-e40f07211f5f15dcb138e2520a76d13afd3c0cfd.tar.bz2
lphub-e40f07211f5f15dcb138e2520a76d13afd3c0cfd.zip
formatted with prettier
Diffstat (limited to 'frontend/src/api/Games.ts')
-rw-r--r--frontend/src/api/Games.ts28
1 files changed, 16 insertions, 12 deletions
diff --git a/frontend/src/api/Games.ts b/frontend/src/api/Games.ts
index 72bb4b3..0e47091 100644
--- a/frontend/src/api/Games.ts
+++ b/frontend/src/api/Games.ts
@@ -1,31 +1,35 @@
1import axios from "axios"; 1import axios from 'axios';
2import { url } from "@api/Api"; 2import { url } from '@api/Api';
3import { GameChapter, GamesChapters } from "@customTypes/Chapters"; 3import { GameChapter, GamesChapters } from '@customTypes/Chapters';
4import { Game } from "@customTypes/Game"; 4import { Game } from '@customTypes/Game';
5import { Map } from "@customTypes/Map"; 5import { Map } from '@customTypes/Map';
6import { Search } from "@customTypes/Search"; 6import { Search } from '@customTypes/Search';
7 7
8export const get_games = async (): Promise<Game[]> => { 8export const get_games = async (): Promise<Game[]> => {
9 const response = await axios.get(url(`games`)) 9 const response = await axios.get(url(`games`));
10 return response.data.data; 10 return response.data.data;
11}; 11};
12 12
13export const get_chapters = async (chapter_id: string): Promise<GameChapter> => { 13export const get_chapters = async (
14 chapter_id: string
15): Promise<GameChapter> => {
14 const response = await axios.get(url(`chapters/${chapter_id}`)); 16 const response = await axios.get(url(`chapters/${chapter_id}`));
15 return response.data.data; 17 return response.data.data;
16} 18};
17 19
18export const get_games_chapters = async (game_id: string): Promise<GamesChapters> => { 20export const get_games_chapters = async (
21 game_id: string
22): Promise<GamesChapters> => {
19 const response = await axios.get(url(`games/${game_id}`)); 23 const response = await axios.get(url(`games/${game_id}`));
20 return response.data.data; 24 return response.data.data;
21}; 25};
22 26
23export const get_game_maps = async (game_id: string): Promise<Map[]> => { 27export const get_game_maps = async (game_id: string): Promise<Map[]> => {
24 const response = await axios.get(url(`games/${game_id}/maps`)) 28 const response = await axios.get(url(`games/${game_id}/maps`));
25 return response.data.data.maps; 29 return response.data.data.maps;
26}; 30};
27 31
28export const get_search = async (q: string): Promise<Search> => { 32export const get_search = async (q: string): Promise<Search> => {
29 const response = await axios.get(url(`search?q=${q}`)) 33 const response = await axios.get(url(`search?q=${q}`));
30 return response.data.data; 34 return response.data.data;
31}; 35};