From d9dc22a63897c23ce0ce219eeba0b8ee97660109 Mon Sep 17 00:00:00 2001 From: Parker Date: Fri, 29 Sep 2023 08:42:07 -0700 Subject: [PATCH] Remove try/catch, other minor tweaks --- app/components/ui/calendar.tsx | 2 +- app/routes/calendar+/index.tsx | 24 ++++++++++-------------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/app/components/ui/calendar.tsx b/app/components/ui/calendar.tsx index fe75808..6232c59 100644 --- a/app/components/ui/calendar.tsx +++ b/app/components/ui/calendar.tsx @@ -3,7 +3,7 @@ import { ChevronLeft, ChevronRight } from "lucide-react" import { DayPicker } from "react-day-picker" import { cn } from "~/utils/misc.ts" -import { buttonVariants } from "~/components/ui/button" +import { buttonVariants } from "~/components/ui/button.tsx" export type CalendarProps = React.ComponentProps diff --git a/app/routes/calendar+/index.tsx b/app/routes/calendar+/index.tsx index 408bca3..28c5d7a 100644 --- a/app/routes/calendar+/index.tsx +++ b/app/routes/calendar+/index.tsx @@ -140,7 +140,7 @@ const instructorSchema = z const createEventSchema = z.object({ title: z.string().min(1, 'Title is required'), dates: z.string().regex(new RegExp(/^(\d{4}-\d{2}-\d{2},?\s?)+$/g), 'Invalid dates'), - startTime: z.string().regex(new RegExp(/\d{2}:\d{2}/g), 'Invalid start time'), + startTime: z.string().regex(new RegExp(/^\d{2}:\d{2}$/g), 'Invalid start time'), duration: z.coerce.number().gt(0), horses: z.array(horseSchema).optional(), instructor: instructorSchema, @@ -246,19 +246,15 @@ export async function action({ request }: ActionArgs) { }), ) } - try { - await prisma.$transaction(transactions) - return json( - { - status: 'success', - submission, - message: null, - } as const, - { status: 200 }, - ) - } catch (e) { - console.log(e) - } + await prisma.$transaction(transactions) + return json( + { + status: 'success', + submission, + message: null, + } as const, + { status: 200 }, + ) } export default function Schedule() {