Skip to content

Commit

Permalink
feat: handle tip being null on create form
Browse files Browse the repository at this point in the history
  • Loading branch information
jbranchaud committed Dec 21, 2023
1 parent 80d77ef commit cab3dd7
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@ export function NewTipForm() {

const onSubmit = async (values: z.infer<typeof NewTipFormSchema>) => {
const tip = await createTip(values)
router.push(`/tips/${tip.slug}`)

if (!tip) {
// handle edge, e.g. toast an error message
} else {
router.push(`/tips/${tip.slug}`)
}
}

return (
Expand Down

0 comments on commit cab3dd7

Please sign in to comment.