+
Enter the OTP
{errors.pin && (
{errors.pin.message}
diff --git a/components/block-device-dialog.tsx b/components/block-device-dialog.tsx
index 9124b61..9de0b2b 100644
--- a/components/block-device-dialog.tsx
+++ b/components/block-device-dialog.tsx
@@ -1,6 +1,6 @@
"use client";
-import { blockDevice } from "@/actions/omada-actions";
+import { blockDevice as BlockDeviceFromOmada } from "@/actions/omada-actions";
import { Button } from "@/components/ui/button";
import {
Dialog,
@@ -13,6 +13,8 @@ import {
import { Label } from "@/components/ui/label";
import type { Device } from "@/lib/backend-types";
import { cn } from "@/lib/utils";
+import { blockDevice } from "@/queries/devices";
+
import { zodResolver } from "@hookform/resolvers/zod";
import { OctagonX } from "lucide-react";
import { useState } from "react";
@@ -46,11 +48,9 @@ export default function BlockDeviceDialog({
console.log(data);
toast.promise(
blockDevice({
- macAddress: device.mac,
- type: type,
- reason: data.reasonForBlocking,
- blockedBy: "ADMIN",
- // reason: data.reasonForBlocking,
+ deviceId: String(device.id),
+ reason_for_blocking: data.reasonForBlocking,
+ blocked_by: "ADMIN",
}),
{
loading: "Blocking...",
@@ -75,7 +75,7 @@ export default function BlockDeviceDialog({
onClick={() => {
setDisabled(true);
toast.promise(
- blockDevice({
+ BlockDeviceFromOmada({
macAddress: device.mac,
type: "unblock",
reason: "",
@@ -104,7 +104,7 @@ export default function BlockDeviceDialog({
onClick={() => {
setDisabled(true);
toast.promise(
- blockDevice({
+ BlockDeviceFromOmada({
macAddress: device.mac,
type: "block",
reason: "",
diff --git a/components/client-error-message.tsx b/components/client-error-message.tsx
index 6f56bac..cdb50d7 100644
--- a/components/client-error-message.tsx
+++ b/components/client-error-message.tsx
@@ -8,14 +8,18 @@ export default function ClientErrorMessage({ message }: { message: string }) {
{message}
-
- Please contact the administrator to give you permissions.
-
-
-
- 919-8026
-
-
+ {message === "You do not have permission to perform this action." && (
+ <>
+
+ Please contact the administrator to give you permissions.
+
+
+
+ 919-8026
+
+
+ >
+ )}
);
diff --git a/components/devices-table.tsx b/components/devices-table.tsx
index 2142d84..f80a64a 100644
--- a/components/devices-table.tsx
+++ b/components/devices-table.tsx
@@ -40,8 +40,11 @@ export async function DevicesTable({
getDevices({ query: query, limit: limit, offset: offset }),
);
if (error) {
- if (error.message === "Invalid token.") redirect("/auth/signin");
- return