Skip to content

Commit

Permalink
misc fix
Browse files Browse the repository at this point in the history
  • Loading branch information
GreenWizard2015 committed Jan 1, 2024
1 parent 5b46699 commit 9ed676e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions ui/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import APIAddressField from './components/APIAddressField';
const STORE_RUNTIME = 'runTime';

function App() {
const waterPumpCtx = useWaterPumpAPI();
const waterPump = useWaterPumpAPI().API;
const [runTime, setRunTime] = useState(1000);
const NotificationsSystem = useNotificationsSystem();

Expand All @@ -32,7 +32,7 @@ function App() {

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

const handleStop = async () => {
try {
await waterPumpCtx.API.stop();
await waterPump.stop();
NotificationsSystem.alert('Water pump stopped successfully!');
} catch (error) {
NotificationsSystem.alert('Error stopping water pump: ' + error.message);
Expand Down
8 changes: 4 additions & 4 deletions ui/src/index.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App.js';
import 'bootstrap/dist/css/bootstrap.min.css'; // Importing Bootstrap CSS

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

ReactDOM.render(
import { createRoot } from 'react-dom/client';
const root = createRoot(document.getElementById('root'));
root.render(
<React.StrictMode>
<NotificationsProvider>
<WaterPumpAPIProvider>
<App />
</WaterPumpAPIProvider>
</NotificationsProvider>
</React.StrictMode>,
document.getElementById('root')
</React.StrictMode>
);

0 comments on commit 9ed676e

Please sign in to comment.