Skip to content

Commit

Permalink
Remove try/catch, other minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
parkerdavis1 authored and benhsm committed Nov 10, 2023
1 parent 4b13a21 commit d9dc22a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
2 changes: 1 addition & 1 deletion app/components/ui/calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof DayPicker>

Expand Down
24 changes: 10 additions & 14 deletions app/routes/calendar+/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit d9dc22a

Please sign in to comment.