From 0ba41828ddbce5e4051df91dba0f3b4a8565c170 Mon Sep 17 00:00:00 2001 From: UUBulb <35923940+uubulb@users.noreply.github.com> Date: Wed, 29 Jan 2025 15:07:20 +0800 Subject: [PATCH] minor bug fixes (#110) --- src/components/nat.tsx | 5 ++--- src/hooks/useNotfication.tsx | 2 +- src/hooks/useServer.tsx | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/components/nat.tsx b/src/components/nat.tsx index 2adeefc..f82677f 100644 --- a/src/components/nat.tsx +++ b/src/components/nat.tsx @@ -29,6 +29,7 @@ import { useTranslation } from "react-i18next" import { toast } from "sonner" import { KeyedMutator } from "swr" import { z } from "zod" + import { Checkbox } from "./ui/checkbox" import { Label } from "./ui/label" @@ -163,9 +164,7 @@ export const NATCard: React.FC = ({ data, mutate }) => { checked={field.value} onCheckedChange={field.onChange} /> - + diff --git a/src/hooks/useNotfication.tsx b/src/hooks/useNotfication.tsx index c98e6f9..855a322 100644 --- a/src/hooks/useNotfication.tsx +++ b/src/hooks/useNotfication.tsx @@ -44,7 +44,7 @@ export const NotificationProvider: React.FC = ({ if (withNotifier) (async () => { try { - const n = await getNotification() + const n = (await getNotification()) || [] const nData = n.map(({ id, name }) => ({ id, name })) setNotifier(nData) } catch (error: any) { diff --git a/src/hooks/useServer.tsx b/src/hooks/useServer.tsx index 46861b3..2942526 100644 --- a/src/hooks/useServer.tsx +++ b/src/hooks/useServer.tsx @@ -44,7 +44,7 @@ export const ServerProvider: React.FC = ({ if (withServer) (async () => { try { - const s = await getServers() + const s = (await getServers()) || [] const serverData = s.map(({ id, name }) => ({ id, name })) setServer(serverData) } catch (error: any) {