Skip to content

Commit 9ed676e

Browse files
misc fix
1 parent 5b46699 commit 9ed676e

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

ui/src/App.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import APIAddressField from './components/APIAddressField';
1010
const STORE_RUNTIME = 'runTime';
1111

1212
function App() {
13-
const waterPumpCtx = useWaterPumpAPI();
13+
const waterPump = useWaterPumpAPI().API;
1414
const [runTime, setRunTime] = useState(1000);
1515
const NotificationsSystem = useNotificationsSystem();
1616

@@ -32,7 +32,7 @@ function App() {
3232

3333
const handleStart = async () => {
3434
try {
35-
await waterPumpCtx.API.start(runTime);
35+
await waterPump.start(runTime);
3636
NotificationsSystem.alert('Water pump started successfully!');
3737
} catch (error) {
3838
NotificationsSystem.alert('Error starting water pump: ' + error.message);
@@ -41,7 +41,7 @@ function App() {
4141

4242
const handleStop = async () => {
4343
try {
44-
await waterPumpCtx.API.stop();
44+
await waterPump.stop();
4545
NotificationsSystem.alert('Water pump stopped successfully!');
4646
} catch (error) {
4747
NotificationsSystem.alert('Error stopping water pump: ' + error.message);

ui/src/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import React from 'react';
2-
import ReactDOM from 'react-dom';
32
import App from './App.js';
43
import 'bootstrap/dist/css/bootstrap.min.css'; // Importing Bootstrap CSS
54

65
import { NotificationsProvider } from './contexts/NotificationsContext.js';
76
import { WaterPumpAPIProvider } from './contexts/WaterPumpAPIContext.js';
87

9-
ReactDOM.render(
8+
import { createRoot } from 'react-dom/client';
9+
const root = createRoot(document.getElementById('root'));
10+
root.render(
1011
<React.StrictMode>
1112
<NotificationsProvider>
1213
<WaterPumpAPIProvider>
1314
<App />
1415
</WaterPumpAPIProvider>
1516
</NotificationsProvider>
16-
</React.StrictMode>,
17-
document.getElementById('root')
17+
</React.StrictMode>
1818
);

0 commit comments

Comments
 (0)