chore: fix connection error

was connected to wrong endpoint after merge

ref: N25B-400
This commit is contained in:
Pim Hutting
2026-01-12 15:17:38 +01:00
parent c2486f5f43
commit 96242fa6b0

View File

@@ -1,5 +1,6 @@
import { useEffect } from 'react'; import { useEffect } from 'react';
const API_BASE = "http://localhost:8000/button_pressed"; // Change depending on Pims interup agent/ correct endpoint const API_BASE_BP = "http://localhost:8000/button_pressed"; // Change depending on Pims interup agent/ correct endpoint
const API_BASE = "http://localhost:8000";
/** /**
@@ -8,7 +9,7 @@ const API_BASE = "http://localhost:8000/button_pressed"; // Change depending on
*/ */
const sendAPICall = async (type: string, context: string, endpoint?: string) => { const sendAPICall = async (type: string, context: string, endpoint?: string) => {
try { try {
const response = await fetch(`${API_BASE}${endpoint ?? ""}`, { const response = await fetch(`${API_BASE_BP}${endpoint ?? ""}`, {
method: "POST", method: "POST",
headers: { "Content-Type": "application/json" }, headers: { "Content-Type": "application/json" },
body: JSON.stringify({ type, context }), body: JSON.stringify({ type, context }),
@@ -71,7 +72,7 @@ export async function playExperiment(): Promise<void> {
*/ */
export function useExperimentLogger(onUpdate?: (data: any) => void) { export function useExperimentLogger(onUpdate?: (data: any) => void) {
useEffect(() => { useEffect(() => {
const eventSource = new EventSource(`${API_BASE}`); const eventSource = new EventSource(`${API_BASE}/experiment_stream`);
eventSource.onmessage = (event) => { eventSource.onmessage = (event) => {
try { try {