commit dfb15dfde548e5c4c2a69af3e4dbfdf6a81bc2b7
parent b566fca5429800423b7ceb9193c9bd3a82c3f631
Author: Andreas Gruhler <andreas.gruhler@adfinis.com>
Date: Thu, 26 Sep 2024 22:28:00 +0200
fix(api): bracket and api port
Diffstat:
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/api/server.cjs b/src/api/server.cjs
@@ -170,6 +170,7 @@ server.on('request', async (req, res) => {
} catch(error) {
serverError(res, error);
}
+ }
} else if (req.method === 'POST') {
if (url.pathname === '/v1/echo') {
let body = [];
diff --git a/src/frontend/Leaderboard.jsx b/src/frontend/Leaderboard.jsx
@@ -7,7 +7,7 @@ const api_uri = import.meta.env.VITE_API_URI ? import.meta.env.VITE_API_URI: 'ht
const api_port = import.meta.env.VITE_API_PORT ? import.meta.env.VITE_API_PORT: '8000'
// use a socket for the real-time leaderboard data
-let socket = new WebSocket("ws://127.0.0.1:8000/v1/leaderboard");
+let socket = new WebSocket(`ws://127.0.0.1:${api_port}/v1/leaderboard`);
export async function addAthleteToHeat(athlete, heat) {
const res = await fetch(`${api_uri}:${api_port}/v1/leaderboard/addAthleteToHeat`, {