diff --git a/ui/console-src/modules/contents/pages/SinglePageEditor.vue b/ui/console-src/modules/contents/pages/SinglePageEditor.vue index b177208d9..8241b9a40 100644 --- a/ui/console-src/modules/contents/pages/SinglePageEditor.vue +++ b/ui/console-src/modules/contents/pages/SinglePageEditor.vue @@ -220,9 +220,15 @@ const handlePublish = async () => { }); if (returnToView.value && permalink) { + handleClearCache(routeQueryName.value); window.location.href = permalink; - } else { + return; + } + + if (router.options.history.state.back === null) { router.push({ name: "SinglePages" }); + } else { + router.back(); } } else { formState.value.page.spec.publish = true; @@ -237,7 +243,7 @@ const handlePublish = async () => { } Toast.success(t("core.common.toast.publish_success")); - handleClearCache(routeQueryName.value as string); + handleClearCache(routeQueryName.value); } catch (error) { console.error("Failed to publish single page", error); Toast.error(t("core.common.toast.publish_failed_and_retry")); diff --git a/ui/console-src/modules/contents/posts/PostEditor.vue b/ui/console-src/modules/contents/posts/PostEditor.vue index 271432d56..4cd7101e5 100644 --- a/ui/console-src/modules/contents/posts/PostEditor.vue +++ b/ui/console-src/modules/contents/posts/PostEditor.vue @@ -262,9 +262,15 @@ const handlePublish = async () => { }); if (returnToView.value === "true" && permalink) { + handleClearCache(name.value); window.location.href = permalink; - } else { + return; + } + + if (router.options.history.state.back === null) { router.push({ name: "Posts" }); + } else { + router.back(); } } else { const { data } = await consoleApiClient.content.post.draftPost({