mirror of
https://github.com/shadcn-ui/taxonomy
synced 2026-05-24 01:38:28 +00:00
feat: invalidate cache on post save
This commit is contained in:
parent
de31e9fc30
commit
59e5bf7a28
1 changed files with 4 additions and 0 deletions
|
|
@ -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<EditorJS>()
|
||||
const router = useRouter()
|
||||
const [isSaving, setIsSaving] = React.useState<boolean>(false)
|
||||
const [isMounted, setIsMounted] = React.useState<boolean>(false)
|
||||
|
||||
|
|
@ -101,6 +103,8 @@ export function Editor({ post }: EditorProps) {
|
|||
})
|
||||
}
|
||||
|
||||
router.refresh()
|
||||
|
||||
return toast({
|
||||
message: "Your post has been saved.",
|
||||
type: "success",
|
||||
|
|
|
|||
Loading…
Reference in a new issue