Skip to content

Commit 2783d29

Browse files
committed
unzodify zod
1 parent 1cdd8a3 commit 2783d29

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

apps/dashboard/components/website-dialog.tsx

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22

33
import { authClient } from '@databuddy/auth/client';
44
import { zodResolver } from '@hookform/resolvers/zod';
5-
import type { TRPCError } from '@trpc/server';
65
import { LoaderCircle } from 'lucide-react';
76
import { useEffect, useRef } from 'react';
87
import { useForm } from 'react-hook-form';
98
import { toast } from 'sonner';
10-
import z from 'zod/v4';
9+
import * as z from 'zod';
1110
import { Button } from '@/components/ui/button';
1211
import {
1312
Dialog,
@@ -53,9 +52,7 @@ export function WebsiteDialog({
5352
open,
5453
onOpenChange,
5554
website,
56-
onSave = () => {
57-
// Do nothing
58-
},
55+
onSave = () => {},
5956
}: WebsiteDialogProps) {
6057
const isEditing = !!website;
6158
const { data: activeOrganization } = authClient.useActiveOrganization();
@@ -80,7 +77,7 @@ export function WebsiteDialog({
8077
}
8178
}, [website, form]);
8279

83-
const handleSubmit = form.handleSubmit((formData) => {
80+
const handleSubmit = form.handleSubmit(async (formData) => {
8481
const submissionData: CreateWebsiteData = {
8582
name: formData.name,
8683
domain: formData.domain,
@@ -99,9 +96,9 @@ export function WebsiteDialog({
9996
onOpenChange(false);
10097
return `Website ${isEditing ? 'updated' : 'created'} successfully!`;
10198
},
102-
error: (err: TRPCError) => {
99+
error: (err: any) => {
103100
const message =
104-
err.code === 'CONFLICT'
101+
err.data?.code === 'CONFLICT'
105102
? 'A website with this domain already exists.'
106103
: `Failed to ${isEditing ? 'update' : 'create'} website.`;
107104
return message;
@@ -167,9 +164,7 @@ export function WebsiteDialog({
167164
) {
168165
try {
169166
domain = new URL(domain).hostname;
170-
} catch {
171-
// Do nothing
172-
}
167+
} catch {}
173168
}
174169
field.onChange(domain.replace(/^www\./, ''));
175170
}}

0 commit comments

Comments
 (0)