feat(rfid): added in manual trigger for rfid reader at the wrapper
This commit is contained in:
31
frontend/src/components/logistics/rfid/ManualTrigger.tsx
Normal file
31
frontend/src/components/logistics/rfid/ManualTrigger.tsx
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
import { Button } from "@/components/ui/button";
|
||||||
|
import axios from "axios";
|
||||||
|
|
||||||
|
import { toast } from "sonner";
|
||||||
|
|
||||||
|
export default function ManualTrigger() {
|
||||||
|
const rfidReaderTrigger = async () => {
|
||||||
|
try {
|
||||||
|
const res = await axios.post("/api/rfid/manualtrigger/wrapper1");
|
||||||
|
|
||||||
|
if (res.data.success) {
|
||||||
|
toast.success(res.data.message);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!res.data.success) {
|
||||||
|
toast.error(res.data.message);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
|
||||||
|
//stoast.success(error.data.message);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<Button onClick={rfidReaderTrigger}>Wrapper 1 RFID</Button>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user