feat: introduce backend url environment variable
ref: N25B-352
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
// University within the Software Project course.
|
||||
// © Copyright Utrecht University (Department of Information and Computing Sciences)
|
||||
import { useEffect, useState } from 'react'
|
||||
import { API_BASE_URL } from '../../config/api.ts';
|
||||
|
||||
/**
|
||||
* Displays the current connection status of a robot in real time.
|
||||
@@ -25,7 +26,7 @@ export default function ConnectedRobots() {
|
||||
useEffect(() => {
|
||||
// Open a Server-Sent Events (SSE) connection to receive live ping updates.
|
||||
// We're expecting a stream of data like that looks like this: `data = False` or `data = True`
|
||||
const eventSource = new EventSource("http://localhost:8000/robot/ping_stream");
|
||||
const eventSource = new EventSource(`${API_BASE_URL}/robot/ping_stream`);
|
||||
eventSource.onmessage = (event) => {
|
||||
|
||||
// Expecting messages in JSON format: `true` or `false`
|
||||
|
||||
Reference in New Issue
Block a user