From 47089161eb8b4e0d6bb227f09634bdea0fea3516 Mon Sep 17 00:00:00 2001 From: mbecker20 Date: Wed, 13 Apr 2022 00:17:18 -0700 Subject: [PATCH] dynamic url for development and production --- frontend/src/index.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/src/index.tsx b/frontend/src/index.tsx index a1be9ec34..42f14aec2 100644 --- a/frontend/src/index.tsx +++ b/frontend/src/index.tsx @@ -12,8 +12,12 @@ import { DimensionProvider } from "./state/DimensionProvider"; import LoginGuard from "./components/login/LoginGuard"; import { AppStateProvider } from "./state/StateProvider"; -export const URL = "http://localhost:9000"; -export const WS_URL = "ws://localhost:9000/ws"; +export const URL = + import.meta.env.MODE === "production" + ? location.origin + : "http://localhost:9000"; +export const WS_URL = URL.replace("https", "wss").replace("http", "ws") + "/ws"; + export const client = new Client(URL); export const { Notifications, pushNotification } = makeNotifications();