From e9fe0c0a3a4f12fc3d8410f08a6408afef21a356 Mon Sep 17 00:00:00 2001 From: cv <34649812+cpvalente@users.noreply.github.com> Date: Sat, 15 Apr 2023 12:46:17 +0200 Subject: [PATCH] fix: resolve to static port in dev mode --- apps/client/src/common/api/apiConstants.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/apps/client/src/common/api/apiConstants.ts b/apps/client/src/common/api/apiConstants.ts index d8934acda..b9ddbd9cd 100644 --- a/apps/client/src/common/api/apiConstants.ts +++ b/apps/client/src/common/api/apiConstants.ts @@ -15,14 +15,9 @@ export const RUNTIME = ['runtimeStore']; // external stuff export const githubURL = 'https://api.github.com/repos/cpvalente/ontime/releases/latest'; -/** - * @description finds server path given the current location, it - * @return {*} - */ -export const calculateServer = () => (import.meta.env.DEV ? `http://localhost:${window.location.port}` : window.location.origin); - -export const serverURL = calculateServer(); -export const websocketUrl = `ws://${window.location.hostname}:${window.location.port}/ws`; +export const serverPort = import.meta.env.DEV ? STATIC_PORT : window.location.port; +export const serverURL = import.meta.env.DEV ? `http://localhost:${serverPort}` : window.location.origin; +export const websocketUrl = `ws://${window.location.hostname}:${serverPort}/ws`; export const eventURL = `${serverURL}/eventdata`; export const rundownURL = `${serverURL}/events`;