mirror of
https://github.com/cfngc4594/monaco-editor-lsp-next.git
synced 2025-07-04 01:10:53 +00:00
feat(problems): add published check in problem layout
This commit is contained in:
parent
9b231cc5e5
commit
9216f6e285
@ -1,3 +1,4 @@
|
||||
import prisma from "@/lib/prisma";
|
||||
import { notFound } from "next/navigation";
|
||||
import { ProblemHeader } from "@/features/problems/components/header";
|
||||
|
||||
@ -13,6 +14,19 @@ const Layout = async ({ children, params }: LayoutProps) => {
|
||||
return notFound();
|
||||
}
|
||||
|
||||
const problem = await prisma.problem.findUnique({
|
||||
select: {
|
||||
isPublished: true,
|
||||
},
|
||||
where: {
|
||||
id: problemId,
|
||||
},
|
||||
});
|
||||
|
||||
if (!problem?.isPublished) {
|
||||
return notFound();
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex flex-col h-screen">
|
||||
<ProblemHeader />
|
||||
|
Loading…
Reference in New Issue
Block a user