Skip to content

Commit

Permalink
add 404 to user page
Browse files Browse the repository at this point in the history
  • Loading branch information
minhd-vu committed Mar 2, 2024
1 parent 07dccec commit a4af608
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/user/[name]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import prisma from "@/lib/prisma";
import { notFound } from "next/navigation";

export default async function UserById({
params,
Expand All @@ -9,7 +10,7 @@ export default async function UserById({
const user = await prisma.user.findUnique({ where: { name } });

if (!user) {
return <p>No user found with name {name}</p>;
return notFound();
}

return (
Expand Down

0 comments on commit a4af608

Please sign in to comment.