From 36478f26d5b59eaae4d26862264b39547421a28b Mon Sep 17 00:00:00 2001 From: Davide Passoni Date: Fri, 28 Jun 2024 11:25:30 +0200 Subject: [PATCH] Added ability to preview on proxy --- frontend/react/src/olympusapp.ts | 6 ++---- frontend/react/src/unit/databases/aircraftdatabase.ts | 3 +-- frontend/react/src/unit/databases/groundunitdatabase.ts | 3 +-- frontend/react/src/unit/databases/helicopterdatabase.ts | 3 +-- frontend/react/src/unit/databases/navyunitdatabase.ts | 3 +-- frontend/react/vite.config.js | 1 + 6 files changed, 7 insertions(+), 12 deletions(-) diff --git a/frontend/react/src/olympusapp.ts b/frontend/react/src/olympusapp.ts index 442b97c8..d47e4ec6 100644 --- a/frontend/react/src/olympusapp.ts +++ b/frontend/react/src/olympusapp.ts @@ -158,8 +158,7 @@ export class OlympusApp { this.#weaponsManager = new WeaponsManager(); /* Set the address of the server */ - // Temporary forcing port 3000 for development - this.getServerManager().setAddress(window.location.href.split('?')[0].replace('8080', '3000')); + this.getServerManager().setAddress(window.location.href.split('?')[0]); /* Setup all global events */ this.#setupEvents(); @@ -182,8 +181,7 @@ export class OlympusApp { }) /* Load the config file from the server */ - // Temporary forcing port 3000 for development - const configRequest = new Request(window.location.href.split('?')[0].replace('8080', '3000') + "resources/config"); + const configRequest = new Request(window.location.href.split('?')[0] + "resources/config"); fetch(configRequest).then((response) => { if (response.status === 200) { return response.json(); diff --git a/frontend/react/src/unit/databases/aircraftdatabase.ts b/frontend/react/src/unit/databases/aircraftdatabase.ts index 2b45f5e6..6a2088d5 100644 --- a/frontend/react/src/unit/databases/aircraftdatabase.ts +++ b/frontend/react/src/unit/databases/aircraftdatabase.ts @@ -4,8 +4,7 @@ import { UnitDatabase } from "./unitdatabase" export class AircraftDatabase extends UnitDatabase { constructor() { - // Temporary forcing port 3000 for development - super(window.location.href.split('?')[0].replace('8080', '3000') + 'api/databases/units/aircraftdatabase'); + super(window.location.href.split('?')[0] + 'api/databases/units/aircraftdatabase'); } getCategory() { diff --git a/frontend/react/src/unit/databases/groundunitdatabase.ts b/frontend/react/src/unit/databases/groundunitdatabase.ts index e104a238..dbdccacf 100644 --- a/frontend/react/src/unit/databases/groundunitdatabase.ts +++ b/frontend/react/src/unit/databases/groundunitdatabase.ts @@ -4,8 +4,7 @@ import { UnitDatabase } from "./unitdatabase" export class GroundUnitDatabase extends UnitDatabase { constructor() { - // Temporary forcing port 3000 for development - super(window.location.href.split('?')[0].replace('8080', '3000') + 'api/databases/units/groundunitdatabase'); + super(window.location.href.split('?')[0] + 'api/databases/units/groundunitdatabase'); } getSpawnPointsByName(name: string) { diff --git a/frontend/react/src/unit/databases/helicopterdatabase.ts b/frontend/react/src/unit/databases/helicopterdatabase.ts index 9fe3f647..e24c2a34 100644 --- a/frontend/react/src/unit/databases/helicopterdatabase.ts +++ b/frontend/react/src/unit/databases/helicopterdatabase.ts @@ -4,8 +4,7 @@ import { UnitDatabase } from "./unitdatabase" export class HelicopterDatabase extends UnitDatabase { constructor() { - // Temporary forcing port 3000 for development - super(window.location.href.split('?')[0].replace('8080', '3000') + 'api/databases/units/helicopterdatabase'); + super(window.location.href.split('?')[0] + 'api/databases/units/helicopterdatabase'); } getSpawnPointsByName(name: string) { diff --git a/frontend/react/src/unit/databases/navyunitdatabase.ts b/frontend/react/src/unit/databases/navyunitdatabase.ts index 39b27b4c..7d22332d 100644 --- a/frontend/react/src/unit/databases/navyunitdatabase.ts +++ b/frontend/react/src/unit/databases/navyunitdatabase.ts @@ -4,8 +4,7 @@ import { UnitDatabase } from "./unitdatabase" export class NavyUnitDatabase extends UnitDatabase { constructor() { - // Temporary forcing port 3000 for development - super(window.location.href.split('?')[0].replace('8080', '3000') + 'api/databases/units/navyunitdatabase'); + super(window.location.href.split('?')[0] + 'api/databases/units/navyunitdatabase'); } getSpawnPointsByName(name: string) { diff --git a/frontend/react/vite.config.js b/frontend/react/vite.config.js index 5a33944a..fbe9d36a 100644 --- a/frontend/react/vite.config.js +++ b/frontend/react/vite.config.js @@ -4,4 +4,5 @@ import react from '@vitejs/plugin-react' // https://vitejs.dev/config/ export default defineConfig({ plugins: [react()], + base: "/vite" })