mirror of
https://github.com/i701/sarlink-portal.git
synced 2025-07-01 15:23:58 +00:00
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
Some checks failed
Build and Push Docker Images / Build and Push Docker Images (push) Failing after 1m39s
This commit is contained in:
@ -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: "",
|
||||
|
Reference in New Issue
Block a user