feat: The Big One UI #47
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user