mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-06-12 15:57:12 +02:00
frontend: getting correct hostname and port
This commit is contained in:
@ -1,7 +1,9 @@
|
||||
import { useEffect, useReducer } from 'react';
|
||||
import { socket } from './socket';
|
||||
import { DataServiceComponent } from './components/DataServiceComponent';
|
||||
import { DataServiceJSON } from './components/GenericComponent';
|
||||
import { hostname, port, socket } from './socket';
|
||||
import {
|
||||
DataServiceComponent,
|
||||
DataServiceJSON
|
||||
} from './components/DataServiceComponent';
|
||||
|
||||
type ValueType = boolean | string | number | object;
|
||||
|
||||
@ -107,7 +109,7 @@ const App = () => {
|
||||
|
||||
useEffect(() => {
|
||||
// Fetch data from the API when the component mounts
|
||||
fetch('http://localhost:8001/service-properties')
|
||||
fetch(`http://${hostname}:${port}/service-properties`)
|
||||
.then((response) => response.json())
|
||||
.then((data: DataServiceJSON) => dispatch({ type: 'SET_DATA', data }));
|
||||
|
||||
|
Reference in New Issue
Block a user