latest changes
This commit is contained in:
1 parent
56cd6fd058
commit
1de72863db
40 files changed
+3837
-568
No files matched your search
@@ -12,12 +12,10 @@ export default async function EditArticle({
|
||||
params: Promise<{ id: string }>;
|
||||
}) {
|
||||
const { id } = await params;
|
||||
let article: Awaited<ReturnType<typeof prisma.websiteArticles.findUnique>> = null;
|
||||
try {
|
||||
article = await prisma.websiteArticles.findUnique({ where: { id: BigInt(id) } });
|
||||
} catch {
|
||||
notFound();
|
||||
}
|
||||
const article = await prisma.websiteArticles.findUnique({
|
||||
where: { id: BigInt(id) },
|
||||
select: { id: true, slug: true, title: true, shortStory: true, fullStory: true, image: true, createdAt: true, updatedAt: true },
|
||||
}).catch(() => null);
|
||||
if (!article) notFound();
|
||||
|
||||
return (
|
||||
@@ -36,7 +34,7 @@ export default async function EditArticle({
|
||||
</form>
|
||||
<form action={deleteArticle} style={{ marginTop: "1rem" }}>
|
||||
<input type="hidden" name="id" value={String(article.id)} />
|
||||
<button type="submit">Delete article</button>
|
||||
<button type="submit" className="btn btn-primary">Delete article</button>
|
||||
</form>
|
||||
</main>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user