From 64fb87d0ceb591a49aacad39bf5e885cab7decfa Mon Sep 17 00:00:00 2001
From: MohamedBassem <me@mbassem.com>
Date: Tue, 19 Mar 2024 12:41:06 +0000
Subject: feature(web): Add support for demo mode

---
 apps/web/components/dashboard/sidebar/NewListModal.tsx | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

(limited to 'apps/web/components/dashboard/sidebar/NewListModal.tsx')

diff --git a/apps/web/components/dashboard/sidebar/NewListModal.tsx b/apps/web/components/dashboard/sidebar/NewListModal.tsx
index e244411d..31c35d6c 100644
--- a/apps/web/components/dashboard/sidebar/NewListModal.tsx
+++ b/apps/web/components/dashboard/sidebar/NewListModal.tsx
@@ -67,10 +67,19 @@ export default function NewListModal() {
     },
     onError: (e) => {
       if (e.data?.code == "BAD_REQUEST") {
-        toast({
-          variant: "destructive",
-          description: e.message,
-        });
+        if (e.data.zodError) {
+          toast({
+            variant: "destructive",
+            description: Object.values(e.data.zodError.fieldErrors)
+              .flat()
+              .join("\n"),
+          });
+        } else {
+          toast({
+            variant: "destructive",
+            description: e.message,
+          });
+        }
       } else {
         toast({
           variant: "destructive",
-- 
cgit v1.2.3-70-g09d2

