diff options
| author | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2025-10-22 13:59:12 +0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-22 12:59:12 +0300 |
| commit | 69aeb7889ac136a8e4fbe7de1330298e30345479 (patch) | |
| tree | 6b2cd2d420105dc7ffad3c3649df359f634cae77 /frontend/src/api | |
| parent | feat/rankings: update wr for 3 maps (#279) (diff) | |
| download | lphub-69aeb7889ac136a8e4fbe7de1330298e30345479.tar.gz lphub-69aeb7889ac136a8e4fbe7de1330298e30345479.tar.bz2 lphub-69aeb7889ac136a8e4fbe7de1330298e30345479.zip | |
feat/frontend: switch to vite, update node to v22 (#281)
Diffstat (limited to 'frontend/src/api')
| -rw-r--r-- | frontend/src/api/Api.ts | 18 | ||||
| -rw-r--r-- | frontend/src/api/Auth.ts | 2 | ||||
| -rw-r--r-- | frontend/src/api/Games.ts | 2 | ||||
| -rw-r--r-- | frontend/src/api/Maps.ts | 4 | ||||
| -rw-r--r-- | frontend/src/api/Rankings.ts | 4 | ||||
| -rw-r--r-- | frontend/src/api/User.ts | 4 |
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 @@ | |||
| 1 | import { MapDiscussionCommentContent, 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 { get_games, get_chapters, get_games_chapters, get_game_maps, get_search } from '@api/Games'; | 4 | import { get_games, get_chapters, get_games_chapters, get_game_maps, get_search } from "@api/Games"; |
| 5 | import { get_official_rankings, get_unofficial_rankings } from '@api/Rankings'; | 5 | import { get_official_rankings, get_unofficial_rankings } from "@api/Rankings"; |
| 6 | import { 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'; | 6 | import { 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"; |
| 7 | import { delete_map_summary, post_map_summary, put_map_image, put_map_summary } from '@api/Mod'; | 7 | import { delete_map_summary, post_map_summary, put_map_image, put_map_summary } from "@api/Mod"; |
| 8 | import { UploadRunContent } from '@customTypes/Content'; | 8 | import { 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 | ||
| 52 | const BASE_API_URL: string = "/api/v1/" | 52 | const BASE_API_URL: string = "https://lp.portal2.sr/api/v1/" |
| 53 | 53 | ||
| 54 | export function url(path: string): string { | 54 | export 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"; | |||
| 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")) |
| 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"; | |||
| 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 | ||
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"; | |||
| 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")); |
| 7 | return response.data.data; | 7 | return response.data.data; |
| 8 | }; | 8 | }; |
| 9 | 9 | ||
| 10 | export const get_unofficial_rankings = async (): Promise<SteamRanking> => { | 10 | export 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 | ||
| 10 | export const get_profile = async (token: string): Promise<UserProfile> => { | 10 | export 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 | ||
| 19 | export const post_profile = async (token: string) => { | 19 | export 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 | } |