new devices system prototype
This commit is contained in:
13
app/providers/DeviceProvider/useDevices.ts
Normal file
13
app/providers/DeviceProvider/useDevices.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { useContext } from "react";
|
||||
import { DeviceProviderContext } from "./DeviceProvider";
|
||||
import { DeviceEntry } from "../ProtocolProvider/protocol/packets/packet.device.list";
|
||||
|
||||
export function useDevices() : DeviceEntry[] {
|
||||
const context = useContext(DeviceProviderContext);
|
||||
|
||||
if(!context) {
|
||||
throw new Error("useDevices must be used within a DeviceProvider");
|
||||
}
|
||||
|
||||
return context.devices;
|
||||
}
|
||||
Reference in New Issue
Block a user