diff --git a/components/editor.tsx b/components/editor.tsx index 3e0fe85..74a52d1 100644 --- a/components/editor.tsx +++ b/components/editor.tsx @@ -8,6 +8,7 @@ import Link from "next/link" import TextareaAutosize from "react-textarea-autosize" import * as z from "zod" import { zodResolver } from "@hookform/resolvers/zod" +import { useRouter } from "next/navigation" import { Icons } from "@/components/icons" import { postPatchSchema } from "@/lib/validations/post" @@ -24,6 +25,7 @@ export function Editor({ post }: EditorProps) { resolver: zodResolver(postPatchSchema), }) const ref = React.useRef() + const router = useRouter() const [isSaving, setIsSaving] = React.useState(false) const [isMounted, setIsMounted] = React.useState(false) @@ -101,6 +103,8 @@ export function Editor({ post }: EditorProps) { }) } + router.refresh() + return toast({ message: "Your post has been saved.", type: "success",