creating error fixed

This commit is contained in:
Cypro Freelance 2024-07-26 01:54:35 +05:30
parent b5c4ca32ed
commit 7cae49ab97
3 changed files with 5 additions and 2 deletions

View file

@ -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" });
}
};

View file

@ -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();

View file

@ -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 }