creating error fixed
This commit is contained in:
parent
b5c4ca32ed
commit
7cae49ab97
3 changed files with 5 additions and 2 deletions
|
@ -41,9 +41,11 @@ const EditPage = ({ params }: { params: { slug: string } }) => {
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
toast({ description: "Page successfully updated" });
|
toast({ description: "Page successfully updated" });
|
||||||
router.push("/admin/multi-logs");
|
router.push(`/admin/multi-logs/`);
|
||||||
} else {
|
} else {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
|
// TEMPERARORY ERROR
|
||||||
|
router.push(`/admin/multi-logs/`);
|
||||||
toast({ description: "Updated but cant return data" });
|
toast({ description: "Updated but cant return data" });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -55,6 +55,7 @@ const MultiLogs = () => {
|
||||||
setPages([...pages, newPage]);
|
setPages([...pages, newPage]);
|
||||||
setPageTitle("");
|
setPageTitle("");
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
|
router.push(`/admin/multi-pages/${slug}`);
|
||||||
toast({ description: "Page created successfully" });
|
toast({ description: "Page created successfully" });
|
||||||
} else {
|
} else {
|
||||||
const errorData = await response.json();
|
const errorData = await response.json();
|
||||||
|
|
|
@ -22,7 +22,7 @@ export const POST = async (req: NextRequest) => {
|
||||||
const db = client.db();
|
const db = client.db();
|
||||||
const { title, slug, content } = await req.json();
|
const { title, slug, content } = await req.json();
|
||||||
|
|
||||||
if (!title || !slug || !content) {
|
if (!slug) {
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
{ message: "Missing required fields" },
|
{ message: "Missing required fields" },
|
||||||
{ status: 400 }
|
{ status: 400 }
|
||||||
|
|
Loading…
Reference in a new issue