From b90a4afc73a9e0acd51ede168d08ff7647be9233 Mon Sep 17 00:00:00 2001 From: i701 Date: Sun, 13 Jul 2025 22:41:26 +0500 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20enhance=20error=20handling=20in=20ha?= =?UTF-8?q?ndleApiResponse=20function=20for=20better=20clarity=20?= =?UTF-8?q?=F0=9F=90=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/tryCatch.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/tryCatch.ts b/utils/tryCatch.ts index f70bbf0..4269b23 100644 --- a/utils/tryCatch.ts +++ b/utils/tryCatch.ts @@ -11,7 +11,7 @@ export async function handleApiResponse( response: Response, fnName?: string, ) { - const responseData = await response.json(); + const responseData = await response.json() if (response.status === 401) { console.log('response data', responseData) throw new Error("UNAUTHORIZED"); @@ -32,7 +32,7 @@ export async function handleApiResponse( if (!response.ok) { console.log(`API Error Response from ${fnName}:`, responseData); - throw new Error(responseData.message || "Something went wrong."); + throw new Error(responseData.message || responseData.detail || "Something went wrong."); } return responseData as T; From 5809e26593c968dc8d0fe6065a67f97c960b9c1b Mon Sep 17 00:00:00 2001 From: i701 Date: Sun, 13 Jul 2025 22:49:11 +0500 Subject: [PATCH 2/3] =?UTF-8?q?refactor:=20simplify=20FloatingInput=20and?= =?UTF-8?q?=20Textarea=20components=20by=20removing=20unnecessary=20forwar?= =?UTF-8?q?dRef=20usage=20=F0=9F=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/input-read-only.tsx | 4 +- components/ui/alert-dialog.tsx | 221 +++++++++++++++++-------------- components/ui/floating-label.tsx | 6 +- components/ui/textarea.tsx | 12 +- 4 files changed, 126 insertions(+), 117 deletions(-) diff --git a/components/input-read-only.tsx b/components/input-read-only.tsx index 851b795..9ef8358 100644 --- a/components/input-read-only.tsx +++ b/components/input-read-only.tsx @@ -1,5 +1,5 @@ -import { cn } from '@/lib/utils'; import { CheckCheck, X } from 'lucide-react'; +import { cn } from '@/lib/utils'; export default function InputReadOnly({ label, value, labelClassName, className, showCheck = true, checkTrue = false }: { label: string; @@ -10,7 +10,7 @@ export default function InputReadOnly({ label, value, labelClassName, className, checkTrue?: boolean }) { return ( -
+