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) {
|
||||
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" });
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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 }
|
||||
|
|
Loading…
Reference in a new issue