From 69aeb7889ac136a8e4fbe7de1330298e30345479 Mon Sep 17 00:00:00 2001 From: Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> Date: Wed, 22 Oct 2025 13:59:12 +0400 Subject: feat/frontend: switch to vite, update node to v22 (#281) --- frontend/src/api/Api.ts | 18 +++++++++--------- frontend/src/api/Auth.ts | 2 +- frontend/src/api/Games.ts | 2 +- frontend/src/api/Maps.ts | 4 ++-- frontend/src/api/Rankings.ts | 4 ++-- frontend/src/api/User.ts | 4 ++-- 6 files changed, 17 insertions(+), 17 deletions(-) (limited to 'frontend/src/api') 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 @@ -import { MapDiscussionCommentContent, MapDiscussionContent, ModMenuContent } from '@customTypes/Content'; -import { delete_token, get_token } from '@api/Auth'; -import { get_user, get_profile, post_profile } from '@api/User'; -import { get_games, get_chapters, get_games_chapters, get_game_maps, get_search } from '@api/Games'; -import { get_official_rankings, get_unofficial_rankings } from '@api/Rankings'; -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'; -import { delete_map_summary, post_map_summary, put_map_image, put_map_summary } from '@api/Mod'; -import { UploadRunContent } from '@customTypes/Content'; +import { MapDiscussionContent, ModMenuContent } from "@customTypes/Content"; +import { delete_token, get_token } from "@api/Auth"; +import { get_user, get_profile, post_profile } from "@api/User"; +import { get_games, get_chapters, get_games_chapters, get_game_maps, get_search } from "@api/Games"; +import { get_official_rankings, get_unofficial_rankings } from "@api/Rankings"; +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"; +import { delete_map_summary, post_map_summary, put_map_image, put_map_summary } from "@api/Mod"; +import { UploadRunContent } from "@customTypes/Content"; // add new api call function entries here // example usage: API.get_games(); @@ -49,7 +49,7 @@ export const API = { delete_map_summary: (token: string, map_id: string, route_id: number) => delete_map_summary(token, map_id, route_id), }; -const BASE_API_URL: string = "/api/v1/" +const BASE_API_URL: string = "https://lp.portal2.sr/api/v1/" export function url(path: string): string { 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"; import { url } from "@api/Api"; export const get_token = async (): Promise => { - const response = await axios.get(url(`token`)) + const response = await axios.get(url("token")) if (!response.data.success) { return undefined; } 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"; import { Search } from "@customTypes/Search"; export const get_games = async (): Promise => { - const response = await axios.get(url(`games`)) + const response = await axios.get(url("games")) return response.data.data; }; 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 // map the kind of leaderboard data.records = data.records.map((record: any) => { if (record.host && record.partner) { - return { ...record, kind: 'multiplayer' }; + return { ...record, kind: "multiplayer" }; } else { - return { ...record, kind: 'singleplayer' }; + return { ...record, kind: "singleplayer" }; } }); 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"; import { Ranking, SteamRanking } from "@customTypes/Ranking"; export const get_official_rankings = async (): Promise => { - const response = await axios.get(url(`rankings/lphub`)); + const response = await axios.get(url("rankings/lphub")); return response.data.data; }; export const get_unofficial_rankings = async (): Promise => { - const response = await axios.get(url(`rankings/steam`)); + const response = await axios.get(url("rankings/steam")); return response.data.data; }; 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 => { }; export const get_profile = async (token: string): Promise => { - const response = await axios.get(url(`profile`), { + const response = await axios.get(url("profile"), { headers: { "Authorization": token, } @@ -17,7 +17,7 @@ export const get_profile = async (token: string): Promise => { }; export const post_profile = async (token: string) => { - const _ = await axios.post(url(`profile`), {}, { + await axios.post(url("profile"), {}, { headers: { "Authorization": token, } -- cgit v1.2.3