Skip to content

Commit

Permalink
Return null instead of undefined in trpc endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
mauriciabad committed Jun 9, 2024
1 parent 0ad1cd1 commit 48661f4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/server/api/router/admin/images.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ export const imagesAdminRouter = router({
return await getAllImages.execute()
}),
getById: adminProcedure.input(getByIdSchema).query(async ({ input }) => {
return await getById.execute({
id: input.id,
})
return (
(await getById.execute({
id: input.id,
})) ?? null
)
}),
})

0 comments on commit 48661f4

Please sign in to comment.