diff options
| author | FifthWit <fifthwitbusiness@gmail.com> | 2025-01-30 10:44:30 -0600 |
|---|---|---|
| committer | FifthWit <fifthwitbusiness@gmail.com> | 2025-01-30 10:44:30 -0600 |
| commit | e40f07211f5f15dcb138e2520a76d13afd3c0cfd (patch) | |
| tree | 46bad6a17e66d55a4a65088c0b6eb8c48641615a /frontend/src/api/Games.ts | |
| parent | added prettier for more consistency (diff) | |
| download | lphub-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.ts | 28 |
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 @@ | |||
| 1 | import axios from "axios"; | 1 | import axios from 'axios'; |
| 2 | import { url } from "@api/Api"; | 2 | import { url } from '@api/Api'; |
| 3 | import { GameChapter, GamesChapters } from "@customTypes/Chapters"; | 3 | import { GameChapter, GamesChapters } from '@customTypes/Chapters'; |
| 4 | import { Game } from "@customTypes/Game"; | 4 | import { Game } from '@customTypes/Game'; |
| 5 | import { Map } from "@customTypes/Map"; | 5 | import { Map } from '@customTypes/Map'; |
| 6 | import { Search } from "@customTypes/Search"; | 6 | import { Search } from '@customTypes/Search'; |
| 7 | 7 | ||
| 8 | export const get_games = async (): Promise<Game[]> => { | 8 | export 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 | ||
| 13 | export const get_chapters = async (chapter_id: string): Promise<GameChapter> => { | 13 | export 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 | ||
| 18 | export const get_games_chapters = async (game_id: string): Promise<GamesChapters> => { | 20 | export 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 | ||
| 23 | export const get_game_maps = async (game_id: string): Promise<Map[]> => { | 27 | export 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 | ||
| 28 | export const get_search = async (q: string): Promise<Search> => { | 32 | export 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 | }; |