aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/api
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/api')
-rw-r--r--frontend/src/api/Api.ts18
-rw-r--r--frontend/src/api/Auth.ts2
-rw-r--r--frontend/src/api/Games.ts2
-rw-r--r--frontend/src/api/Maps.ts4
-rw-r--r--frontend/src/api/Rankings.ts4
-rw-r--r--frontend/src/api/User.ts4
6 files changed, 17 insertions, 17 deletions
diff --git a/frontend/src/api/Api.ts b/frontend/src/api/Api.ts
index c84714d..df787e3 100644
--- a/frontend/src/api/Api.ts
+++ b/frontend/src/api/Api.ts
@@ -1,11 +1,11 @@
1import { MapDiscussionCommentContent, MapDiscussionContent, ModMenuContent } from '@customTypes/Content'; 1import { MapDiscussionContent, ModMenuContent } from "@customTypes/Content";
2import { delete_token, get_token } from '@api/Auth'; 2import { delete_token, get_token } from "@api/Auth";
3import { get_user, get_profile, post_profile } from '@api/User'; 3import { get_user, get_profile, post_profile } from "@api/User";
4import { get_games, get_chapters, get_games_chapters, get_game_maps, get_search } from '@api/Games'; 4import { get_games, get_chapters, get_games_chapters, get_game_maps, get_search } from "@api/Games";
5import { get_official_rankings, get_unofficial_rankings } from '@api/Rankings'; 5import { get_official_rankings, get_unofficial_rankings } from "@api/Rankings";
6import { get_map_summary, get_map_leaderboard, get_map_discussions, get_map_discussion, post_map_discussion, post_map_discussion_comment, delete_map_discussion, post_record, delete_map_record } from '@api/Maps'; 6import { get_map_summary, get_map_leaderboard, get_map_discussions, get_map_discussion, post_map_discussion, post_map_discussion_comment, delete_map_discussion, post_record, delete_map_record } from "@api/Maps";
7import { delete_map_summary, post_map_summary, put_map_image, put_map_summary } from '@api/Mod'; 7import { delete_map_summary, post_map_summary, put_map_image, put_map_summary } from "@api/Mod";
8import { UploadRunContent } from '@customTypes/Content'; 8import { UploadRunContent } from "@customTypes/Content";
9 9
10// add new api call function entries here 10// add new api call function entries here
11// example usage: API.get_games(); 11// example usage: API.get_games();
@@ -49,7 +49,7 @@ export const API = {
49 delete_map_summary: (token: string, map_id: string, route_id: number) => delete_map_summary(token, map_id, route_id), 49 delete_map_summary: (token: string, map_id: string, route_id: number) => delete_map_summary(token, map_id, route_id),
50}; 50};
51 51
52const BASE_API_URL: string = "/api/v1/" 52const BASE_API_URL: string = "https://lp.portal2.sr/api/v1/"
53 53
54export function url(path: string): string { 54export function url(path: string): string {
55 return BASE_API_URL + path; 55 return BASE_API_URL + path;
diff --git a/frontend/src/api/Auth.ts b/frontend/src/api/Auth.ts
index 875c7e5..56e0f6a 100644
--- a/frontend/src/api/Auth.ts
+++ b/frontend/src/api/Auth.ts
@@ -2,7 +2,7 @@ import axios from "axios";
2import { url } from "@api/Api"; 2import { url } from "@api/Api";
3 3
4export const get_token = async (): Promise<string | undefined> => { 4export const get_token = async (): Promise<string | undefined> => {
5 const response = await axios.get(url(`token`)) 5 const response = await axios.get(url("token"))
6 if (!response.data.success) { 6 if (!response.data.success) {
7 return undefined; 7 return undefined;
8 } 8 }
diff --git a/frontend/src/api/Games.ts b/frontend/src/api/Games.ts
index 72bb4b3..98c65e7 100644
--- a/frontend/src/api/Games.ts
+++ b/frontend/src/api/Games.ts
@@ -6,7 +6,7 @@ import { 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
diff --git a/frontend/src/api/Maps.ts b/frontend/src/api/Maps.ts
index aa967ce..8d29f84 100644
--- a/frontend/src/api/Maps.ts
+++ b/frontend/src/api/Maps.ts
@@ -17,9 +17,9 @@ export const get_map_leaderboard = async (map_id: string, page: string): Promise
17 // map the kind of leaderboard 17 // map the kind of leaderboard
18 data.records = data.records.map((record: any) => { 18 data.records = data.records.map((record: any) => {
19 if (record.host && record.partner) { 19 if (record.host && record.partner) {
20 return { ...record, kind: 'multiplayer' }; 20 return { ...record, kind: "multiplayer" };
21 } else { 21 } else {
22 return { ...record, kind: 'singleplayer' }; 22 return { ...record, kind: "singleplayer" };
23 } 23 }
24 }); 24 });
25 return data; 25 return data;
diff --git a/frontend/src/api/Rankings.ts b/frontend/src/api/Rankings.ts
index b8d9bec..a5f4c88 100644
--- a/frontend/src/api/Rankings.ts
+++ b/frontend/src/api/Rankings.ts
@@ -3,11 +3,11 @@ import { url } from "@api/Api";
3import { Ranking, SteamRanking } from "@customTypes/Ranking"; 3import { Ranking, SteamRanking } from "@customTypes/Ranking";
4 4
5export const get_official_rankings = async (): Promise<Ranking> => { 5export 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"));
7 return response.data.data; 7 return response.data.data;
8}; 8};
9 9
10export const get_unofficial_rankings = async (): Promise<SteamRanking> => { 10export const get_unofficial_rankings = async (): Promise<SteamRanking> => {
11 const response = await axios.get(url(`rankings/steam`)); 11 const response = await axios.get(url("rankings/steam"));
12 return response.data.data; 12 return response.data.data;
13}; 13};
diff --git a/frontend/src/api/User.ts b/frontend/src/api/User.ts
index 88da0f2..995902c 100644
--- a/frontend/src/api/User.ts
+++ b/frontend/src/api/User.ts
@@ -8,7 +8,7 @@ export const get_user = async (user_id: string): Promise<UserProfile> => {
8}; 8};
9 9
10export const get_profile = async (token: string): Promise<UserProfile> => { 10export const get_profile = async (token: string): Promise<UserProfile> => {
11 const response = await axios.get(url(`profile`), { 11 const response = await axios.get(url("profile"), {
12 headers: { 12 headers: {
13 "Authorization": token, 13 "Authorization": token,
14 } 14 }
@@ -17,7 +17,7 @@ export const get_profile = async (token: string): Promise<UserProfile> => {
17}; 17};
18 18
19export const post_profile = async (token: string) => { 19export const post_profile = async (token: string) => {
20 const _ = await axios.post(url(`profile`), {}, { 20 await axios.post(url("profile"), {}, {
21 headers: { 21 headers: {
22 "Authorization": token, 22 "Authorization": token,
23 } 23 }