From b50fadc2a0c831ce35731ea42d5c719948adaec1 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Wed, 14 Jun 2023 23:21:12 +0100 Subject: [PATCH] feat: use crossbell kit to delete page --- src/app/dashboard/[subdomain]/editor/page.tsx | 22 +++++++-- .../PagesManagerBatchSelectActionTab.tsx | 5 +- src/components/dashboard/PagesManagerMenu.tsx | 3 +- src/components/dashboard/PublishButton.tsx | 10 ++-- src/models/page.model.ts | 24 ---------- src/queries/page.ts | 46 ++++++++++++------- 6 files changed, 55 insertions(+), 55 deletions(-) diff --git a/src/app/dashboard/[subdomain]/editor/page.tsx b/src/app/dashboard/[subdomain]/editor/page.tsx index 3c55f0a3..c064ebbb 100644 --- a/src/app/dashboard/[subdomain]/editor/page.tsx +++ b/src/app/dashboard/[subdomain]/editor/page.tsx @@ -235,15 +235,22 @@ export default function SubdomainEditor() { delStorage(`draft-${page.data.characterId}-${page.data.draftKey}`) } else { // Is Note - return deleteP.mutateAsync({ - site: subdomain, - id: `${page.data.characterId}-${page.data.noteId}`, + return deleteP.mutate({ + noteId: page.data.noteId, characterId: page.data.characterId, }) } } } + useEffect(() => { + if (deleteP.isSuccess) { + toast.success(t("Deleted!")) + deleteP.reset() + router.push(`/dashboard/${subdomain}/${searchParams?.get("type")}s`) + } + }, [deleteP.isSuccess]) + const [isCheersOpen, setIsCheersOpen] = useState(false) useEffect(() => { @@ -561,7 +568,8 @@ export default function SubdomainEditor() { {t("Preview")} void + savePage: () => void + deletePage: () => void published: boolean isSaving: boolean isDisabled: boolean @@ -50,7 +52,7 @@ export const PublishButton = ({