Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

refactor: clean up API URL handling and remove unused WebSocket hook

Andrej Acevski9a19dd61142f
diff --git a/apps/web/src/constants/urls.ts b/apps/web/src/constants/urls.ts
index b23569a69..006e6f0e9 100644
--- a/apps/web/src/constants/urls.ts
+++ b/apps/web/src/constants/urls.ts
@@ -1,4 +1 @@
-export const API_URL: string =
- (import.meta.env as ImportMetaEnv).VITE_API_URL ?? "http://localhost:1337";
-
export const isDemoMode = window.location.hostname === "demo.kaneo.app";
diff --git a/apps/web/src/hooks/use-board-websocket.ts b/apps/web/src/hooks/use-board-websocket.ts
deleted file mode 100644
index 403a3440c..000000000
--- a/apps/web/src/hooks/use-board-websocket.ts
+++ /dev/null
@@ -1,42 +0,0 @@
-import { API_URL } from "@/constants/urls";
-import { Route } from "@/routes/dashboard/workspace/$workspaceId/project/$projectId";
-import useProjectStore from "@/store/project";
-import { useEffect, useRef } from "react";
-
-type WebSocketHook = {
- ws: WebSocket | null;
-};
-
-function useBoardWebSocket(): WebSocketHook {
- const wsRef = useRef<WebSocket | null>(null);
- const { projectId } = Route.useParams();
- const { setProject } = useProjectStore();
-
- useEffect(() => {
- if (!projectId) return;
-
- const socket = new WebSocket(`${API_URL}/task/ws/${projectId}`);
-
- socket.onmessage = (event) => {
- try {
- const data = JSON.parse(event.data);
- setProject(data);
- } catch (error) {
- console.error("WebSocket message parsing error", error);
- }
- };
-
- wsRef.current = socket;
-
- return () => {
- socket.close();
- wsRef.current = null;
- };
- }, [projectId, setProject]);
-
- return {
- ws: wsRef.current,
- };
-}
-
-export default useBoardWebSocket;
diff --git a/bun.lockb b/bun.lockb
index ee2315582..76436f0fd 100755
Binary files a/bun.lockb and b/bun.lockb differ
diff --git a/packages/libs/src/eden.ts b/packages/libs/src/eden.ts
index 8ff9e1320..b59e5a400 100644
--- a/packages/libs/src/eden.ts
+++ b/packages/libs/src/eden.ts
@@ -2,7 +2,7 @@ import { treaty } from "@elysiajs/eden";
import type { App } from "@kaneo/api";
export const api = treaty<App>(
- (import.meta.env as ImportMetaEnv).KANEO_API_URL ?? "http://localhost:1337",
+ import.meta.env.VITE_API_URL ?? "http://localhost:1337",
{
fetch: {
credentials: "include",