Openstatus www.openstatus.dev

fix: toast error message

authored by

Maximilian Kaske and committed by
Maximilian Kaske
25acedaa a084338e

+8 -3
+8 -3
apps/web/src/components/data-table/user/data-table-row-actions.tsx
··· 24 24 } from "@openstatus/ui"; 25 25 26 26 import { LoadingAnimation } from "@/components/loading-animation"; 27 - import { toastAction } from "@/lib/toast"; 27 + import { toast, toastAction } from "@/lib/toast"; 28 28 import { api } from "@/trpc/client"; 29 29 30 30 interface DataTableRowActionsProps<TData> { ··· 47 47 toastAction("removed"); 48 48 router.refresh(); 49 49 setAlertOpen(false); 50 - } catch { 51 - toastAction("error"); 50 + } catch (error) { 51 + if (error instanceof Error) { 52 + toast.error(error.message); 53 + } else { 54 + toastAction("error"); 55 + } 56 + setAlertOpen(false); 52 57 } 53 58 }); 54 59 }