diff options
Diffstat (limited to 'frontend/src/api')
| -rw-r--r-- | frontend/src/api/Api.ts | 18 | ||||
| -rw-r--r-- | frontend/src/api/Auth.ts | 6 | ||||
| -rw-r--r-- | frontend/src/api/Games.ts | 12 | ||||
| -rw-r--r-- | frontend/src/api/Maps.ts | 12 | ||||
| -rw-r--r-- | frontend/src/api/Mod.ts | 6 | ||||
| -rw-r--r-- | frontend/src/api/Rankings.ts | 6 | ||||
| -rw-r--r-- | frontend/src/api/User.ts | 6 |
7 files changed, 33 insertions, 33 deletions
diff --git a/frontend/src/api/Api.ts b/frontend/src/api/Api.ts index b98dda3..0e1658c 100644 --- a/frontend/src/api/Api.ts +++ b/frontend/src/api/Api.ts | |||
| @@ -1,14 +1,14 @@ | |||
| 1 | import { MapDiscussionContent, ModMenuContent } from '@customTypes/Content'; | 1 | import { MapDiscussionContent, ModMenuContent } from "@customTypes/Content"; |
| 2 | import { delete_token, get_token } from '@api/Auth'; | 2 | import { delete_token, get_token } from "@api/Auth"; |
| 3 | import { get_user, get_profile, post_profile } from '@api/User'; | 3 | import { get_user, get_profile, post_profile } from "@api/User"; |
| 4 | import { | 4 | import { |
| 5 | get_games, | 5 | get_games, |
| 6 | get_chapters, | 6 | get_chapters, |
| 7 | get_games_chapters, | 7 | get_games_chapters, |
| 8 | get_game_maps, | 8 | get_game_maps, |
| 9 | get_search, | 9 | get_search, |
| 10 | } from '@api/Games'; | 10 | } from "@api/Games"; |
| 11 | import { get_official_rankings, get_unofficial_rankings } from '@api/Rankings'; | 11 | import { get_official_rankings, get_unofficial_rankings } from "@api/Rankings"; |
| 12 | import { | 12 | import { |
| 13 | get_map_summary, | 13 | get_map_summary, |
| 14 | get_map_leaderboard, | 14 | get_map_leaderboard, |
| @@ -19,14 +19,14 @@ import { | |||
| 19 | delete_map_discussion, | 19 | delete_map_discussion, |
| 20 | post_record, | 20 | post_record, |
| 21 | delete_map_record, | 21 | delete_map_record, |
| 22 | } from '@api/Maps'; | 22 | } from "@api/Maps"; |
| 23 | import { | 23 | import { |
| 24 | delete_map_summary, | 24 | delete_map_summary, |
| 25 | post_map_summary, | 25 | post_map_summary, |
| 26 | put_map_image, | 26 | put_map_image, |
| 27 | put_map_summary, | 27 | put_map_summary, |
| 28 | } from '@api/Mod'; | 28 | } from "@api/Mod"; |
| 29 | import { UploadRunContent } from '@customTypes/Content'; | 29 | import { UploadRunContent } from "@customTypes/Content"; |
| 30 | 30 | ||
| 31 | // add new api call function entries here | 31 | // add new api call function entries here |
| 32 | // example usage: API.get_games(); | 32 | // example usage: API.get_games(); |
| @@ -91,7 +91,7 @@ export const API = { | |||
| 91 | delete_map_summary(token, map_id, route_id), | 91 | delete_map_summary(token, map_id, route_id), |
| 92 | }; | 92 | }; |
| 93 | 93 | ||
| 94 | const BASE_API_URL: string = '/api/v1/'; | 94 | const BASE_API_URL: string = "/api/v1/"; |
| 95 | 95 | ||
| 96 | export function url(path: string): string { | 96 | export function url(path: string): string { |
| 97 | return BASE_API_URL + path; | 97 | return BASE_API_URL + path; |
diff --git a/frontend/src/api/Auth.ts b/frontend/src/api/Auth.ts index e495d47..98c6d36 100644 --- a/frontend/src/api/Auth.ts +++ b/frontend/src/api/Auth.ts | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | import axios from 'axios'; | 1 | import axios from "axios"; |
| 2 | import { url } from '@api/Api'; | 2 | import { url } from "@api/Api"; |
| 3 | 3 | ||
| 4 | export const get_token = async (): Promise<string | undefined> => { | 4 | export const get_token = async (): Promise<string | undefined> => { |
| 5 | const response = await axios.get(url(`token`)); | 5 | const response = await axios.get(url(`token`)); |
| @@ -10,5 +10,5 @@ export const get_token = async (): Promise<string | undefined> => { | |||
| 10 | }; | 10 | }; |
| 11 | 11 | ||
| 12 | export const delete_token = async () => { | 12 | export const delete_token = async () => { |
| 13 | await axios.delete(url('token')); | 13 | await axios.delete(url("token")); |
| 14 | }; | 14 | }; |
diff --git a/frontend/src/api/Games.ts b/frontend/src/api/Games.ts index 0e47091..b739f80 100644 --- a/frontend/src/api/Games.ts +++ b/frontend/src/api/Games.ts | |||
| @@ -1,9 +1,9 @@ | |||
| 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`)); |
diff --git a/frontend/src/api/Maps.ts b/frontend/src/api/Maps.ts index 3a22f88..2485941 100644 --- a/frontend/src/api/Maps.ts +++ b/frontend/src/api/Maps.ts | |||
| @@ -1,12 +1,12 @@ | |||
| 1 | import axios from 'axios'; | 1 | import axios from "axios"; |
| 2 | import { url } from '@api/Api'; | 2 | import { url } from "@api/Api"; |
| 3 | import { MapDiscussionContent, UploadRunContent } from '@customTypes/Content'; | 3 | import { MapDiscussionContent, UploadRunContent } from "@customTypes/Content"; |
| 4 | import { | 4 | import { |
| 5 | MapSummary, | 5 | MapSummary, |
| 6 | MapLeaderboard, | 6 | MapLeaderboard, |
| 7 | MapDiscussions, | 7 | MapDiscussions, |
| 8 | MapDiscussion, | 8 | MapDiscussion, |
| 9 | } from '@customTypes/Map'; | 9 | } from "@customTypes/Map"; |
| 10 | 10 | ||
| 11 | export const get_map_summary = async (map_id: string): Promise<MapSummary> => { | 11 | export const get_map_summary = async (map_id: string): Promise<MapSummary> => { |
| 12 | const response = await axios.get(url(`maps/${map_id}/summary`)); | 12 | const response = await axios.get(url(`maps/${map_id}/summary`)); |
| @@ -27,9 +27,9 @@ export const get_map_leaderboard = async ( | |||
| 27 | // map the kind of leaderboard | 27 | // map the kind of leaderboard |
| 28 | data.records = data.records.map((record: any) => { | 28 | data.records = data.records.map((record: any) => { |
| 29 | if (record.host && record.partner) { | 29 | if (record.host && record.partner) { |
| 30 | return { ...record, kind: 'multiplayer' }; | 30 | return { ...record, kind: "multiplayer" }; |
| 31 | } else { | 31 | } else { |
| 32 | return { ...record, kind: 'singleplayer' }; | 32 | return { ...record, kind: "singleplayer" }; |
| 33 | } | 33 | } |
| 34 | }); | 34 | }); |
| 35 | return data; | 35 | return data; |
diff --git a/frontend/src/api/Mod.ts b/frontend/src/api/Mod.ts index 69e76c5..d682f1a 100644 --- a/frontend/src/api/Mod.ts +++ b/frontend/src/api/Mod.ts | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | import axios from 'axios'; | 1 | import axios from "axios"; |
| 2 | import { url } from '@api/Api'; | 2 | import { url } from "@api/Api"; |
| 3 | import { ModMenuContent } from '@customTypes/Content'; | 3 | import { ModMenuContent } from "@customTypes/Content"; |
| 4 | 4 | ||
| 5 | export const put_map_image = async ( | 5 | export const put_map_image = async ( |
| 6 | token: string, | 6 | token: string, |
diff --git a/frontend/src/api/Rankings.ts b/frontend/src/api/Rankings.ts index 9afd999..b8d9bec 100644 --- a/frontend/src/api/Rankings.ts +++ b/frontend/src/api/Rankings.ts | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | import axios from 'axios'; | 1 | import axios from "axios"; |
| 2 | import { url } from '@api/Api'; | 2 | import { url } from "@api/Api"; |
| 3 | import { Ranking, SteamRanking } from '@customTypes/Ranking'; | 3 | import { Ranking, SteamRanking } from "@customTypes/Ranking"; |
| 4 | 4 | ||
| 5 | export const get_official_rankings = async (): Promise<Ranking> => { | 5 | export const get_official_rankings = async (): Promise<Ranking> => { |
| 6 | const response = await axios.get(url(`rankings/lphub`)); | 6 | const response = await axios.get(url(`rankings/lphub`)); |
diff --git a/frontend/src/api/User.ts b/frontend/src/api/User.ts index 4ce21e1..004aa22 100644 --- a/frontend/src/api/User.ts +++ b/frontend/src/api/User.ts | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | import axios from 'axios'; | 1 | import axios from "axios"; |
| 2 | import { url } from '@api/Api'; | 2 | import { url } from "@api/Api"; |
| 3 | import { UserProfile } from '@customTypes/Profile'; | 3 | import { UserProfile } from "@customTypes/Profile"; |
| 4 | 4 | ||
| 5 | export const get_user = async (user_id: string): Promise<UserProfile> => { | 5 | export const get_user = async (user_id: string): Promise<UserProfile> => { |
| 6 | const response = await axios.get(url(`users/${user_id}`)); | 6 | const response = await axios.get(url(`users/${user_id}`)); |