This commit is contained in:
Eden Kirin
2024-01-15 23:33:23 +01:00
parent f220d08800
commit 8bc736114c
26 changed files with 20149 additions and 0 deletions

View File

@ -0,0 +1,35 @@
import * as React from "react";
import { useState, useEffect } from "react";
import Grid from "@mui/material/Unstable_Grid2";
import { machinesApi } from "../api";
import { Machines } from "../components/Machines";
function Home() {
const [machines, setMachines] = useState([]);
useEffect(() => {
machinesApi.list().then((response) => {
setMachines(response.data.machines);
});
}, []);
const onMachineSelect = (machineName, machineId) => {
console.log("selected:", machineName);
machinesApi.listProducts(machineId).then((response) => {
console.log(response.data.products);
});
};
return (
<Grid container spacing={2}>
<Grid md={4}>
<Machines machines={machines} onSelect={onMachineSelect} />
</Grid>
<Grid md={8}>...</Grid>
</Grid>
);
}
export { Home };