feat: enhance error handling and improve API response management across components
Some checks failed
Build and Push Docker Images / Build and Push Docker Images (push) Failing after 1m39s

This commit is contained in:
2025-04-14 01:05:07 +05:00
parent 0d578c9add
commit 6365a701ba
11 changed files with 111 additions and 66 deletions

View File

@ -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: "",