From 103d1ce12ce56c273ae531d4e1dfd80ef3a62144 Mon Sep 17 00:00:00 2001 From: Abi Raja Date: Mon, 20 Nov 2023 11:50:06 -0500 Subject: [PATCH] centralize config in config.ts --- frontend/src/config.ts | 3 +++ frontend/src/generateCode.ts | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/src/config.ts b/frontend/src/config.ts index 0cb949c..7a6251c 100644 --- a/frontend/src/config.ts +++ b/frontend/src/config.ts @@ -2,5 +2,8 @@ export const IS_RUNNING_ON_CLOUD = import.meta.env.VITE_IS_DEPLOYED === "true" || false; +export const WS_BACKEND_URL = + import.meta.env.VITE_WS_BACKEND_URL || "ws://127.0.0.1:7001"; + export const HTTP_BACKEND_URL = import.meta.env.VITE_HTTP_BACKEND_URL || "http://127.0.0.1:7001"; diff --git a/frontend/src/generateCode.ts b/frontend/src/generateCode.ts index 3b0f3d6..6fea92d 100644 --- a/frontend/src/generateCode.ts +++ b/frontend/src/generateCode.ts @@ -1,7 +1,6 @@ import toast from "react-hot-toast"; +import { WS_BACKEND_URL } from "./config"; -const WS_BACKEND_URL = - import.meta.env.VITE_WS_BACKEND_URL || "ws://127.0.0.1:7001"; const ERROR_MESSAGE = "Error generating code. Check the Developer Console for details. Feel free to open a Github issue";