From 7cae49ab97f6c13eca75afd5bc1922cf84f28b40 Mon Sep 17 00:00:00 2001 From: Cypro Freelance <110410268+Proxyy587@users.noreply.github.com> Date: Fri, 26 Jul 2024 01:54:35 +0530 Subject: [PATCH] creating error fixed --- app/(auth)/admin/multi-logs/[slug]/page.tsx | 4 +++- app/(auth)/admin/multi-logs/page.tsx | 1 + app/api/mdx/pages/route.ts | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/(auth)/admin/multi-logs/[slug]/page.tsx b/app/(auth)/admin/multi-logs/[slug]/page.tsx index 816cac5..3a66674 100644 --- a/app/(auth)/admin/multi-logs/[slug]/page.tsx +++ b/app/(auth)/admin/multi-logs/[slug]/page.tsx @@ -41,9 +41,11 @@ const EditPage = ({ params }: { params: { slug: string } }) => { if (response.ok) { setLoading(false); toast({ description: "Page successfully updated" }); - router.push("/admin/multi-logs"); + router.push(`/admin/multi-logs/`); } else { setLoading(false); + // TEMPERARORY ERROR + router.push(`/admin/multi-logs/`); toast({ description: "Updated but cant return data" }); } }; diff --git a/app/(auth)/admin/multi-logs/page.tsx b/app/(auth)/admin/multi-logs/page.tsx index 2f00fa3..83791b8 100644 --- a/app/(auth)/admin/multi-logs/page.tsx +++ b/app/(auth)/admin/multi-logs/page.tsx @@ -55,6 +55,7 @@ const MultiLogs = () => { setPages([...pages, newPage]); setPageTitle(""); setOpen(false); + router.push(`/admin/multi-pages/${slug}`); toast({ description: "Page created successfully" }); } else { const errorData = await response.json(); diff --git a/app/api/mdx/pages/route.ts b/app/api/mdx/pages/route.ts index 74f3d58..a3fedb1 100644 --- a/app/api/mdx/pages/route.ts +++ b/app/api/mdx/pages/route.ts @@ -22,7 +22,7 @@ export const POST = async (req: NextRequest) => { const db = client.db(); const { title, slug, content } = await req.json(); - if (!title || !slug || !content) { + if (!slug) { return NextResponse.json( { message: "Missing required fields" }, { status: 400 }